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

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