Code Duplication    Length = 22-23 lines in 2 locations

src/API.php 1 location

@@ 387-409 (lines=23) @@
384
     * @param array $options
385
     * @return Type\BaseFolderType[]
386
     */
387
    public function getChildrenFolders($parentFolderId = 'root', $options = array())
388
    {
389
        if (is_string($parentFolderId)) {
390
            $parentFolderId = $this->getFolderByDistinguishedId($parentFolderId)->getFolderId();
391
        }
392
393
        $request = array(
394
            'Traversal' => 'Shallow',
395
            'FolderShape' => array(
396
                'BaseShape' => 'AllProperties'
397
            ),
398
            'ParentFolderIds' => array(
399
                'FolderId' => $parentFolderId->toArray()
400
            )
401
        );
402
403
        $request = array_replace_recursive($request, $options);
404
405
        $request = Type::buildFromArray($request);
406
407
        /** @var \garethp\ews\API\Message\FindFolderResponseMessageType $folders */
408
        return $this->getClient()->FindFolder($request);
409
    }
410
411
    /**
412
     * @param string $folderName

src/ContactsAPI.php 1 location

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