Code Duplication    Length = 20-21 lines in 2 locations

src/API.php 1 location

@@ 333-353 (lines=21) @@
330
     * @param array $options
331
     * @return Type\BaseFolderType[]
332
     */
333
    public function getChildrenFolders($parentFolderId = 'root', array $options = array())
334
    {
335
        if (is_string($parentFolderId)) {
336
            $parentFolderId = $this->getDistinguishedFolderId($parentFolderId);
337
        }
338
339
        $request = array(
340
            'Traversal' => 'Shallow',
341
            'FolderShape' => array(
342
                'BaseShape' => 'AllProperties'
343
            ),
344
            'ParentFolderIds' => $parentFolderId->toArray(true)
345
        );
346
347
        $request = array_replace_recursive($request, $options);
348
349
        $request = Type::buildFromArray($request);
350
351
        /** @var \garethp\ews\API\Message\FindFolderResponseMessageType $folders */
352
        return $this->getClient()->FindFolder($request);
353
    }
354
355
    /**
356
     * @param string $folderName

src/ContactsAPI.php 1 location

@@ 62-81 (lines=20) @@
59
     * @param array $options
60
     * @return Type\ContactItemType[]
61
     */
62
    public function getContacts($folderId = null, $options = array())
63
    {
64
        if (!$folderId) {
65
            $folderId = $this->getFolderId();
66
        }
67
68
        $request = array(
69
            'Traversal' => 'Shallow',
70
            'ItemShape' => array(
71
                'BaseShape' => 'AllProperties'
72
            ),
73
            'ParentFolderIds' => $folderId->toArray(true)
74
        );
75
76
        $request = array_replace_recursive($request, $options);
77
78
        $request = Type::buildFromArray($request);
79
80
        return $this->getClient()->FindItem($request);
81
    }
82
83
    /**
84
     * @param Type\ItemIdType $itemId