Code Duplication    Length = 22-23 lines in 2 locations

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

src/API.php 1 location

@@ 368-390 (lines=23) @@
365
     * @param array $options
366
     * @return Type\BaseFolderType[]
367
     */
368
    public function getChildrenFolders($parentFolderId = 'root', $options = array())
369
    {
370
        if (is_string($parentFolderId)) {
371
            $parentFolderId = $this->getFolderByDistinguishedId($parentFolderId)->getFolderId();
372
        }
373
374
        $request = array(
375
            'Traversal' => 'Shallow',
376
            'FolderShape' => array(
377
                'BaseShape' => 'AllProperties'
378
            ),
379
            'ParentFolderIds' => array(
380
                'FolderId' => $parentFolderId->toArray()
381
            )
382
        );
383
384
        $request = array_replace_recursive($request, $options);
385
386
        $request = Type::buildFromArray($request);
387
388
        /** @var \garethp\ews\API\Message\FindFolderResponseMessageType $folders */
389
        return $this->getClient()->FindFolder($request);
390
    }
391
392
    /**
393
     * @param string $folderName