Code Duplication    Length = 22-23 lines in 2 locations

src/ContactsAPI.php 1 location

@@ 39-60 (lines=22) @@
36
     * @param array $options
37
     * @return Type\ContactItemType[]
38
     */
39
    public function getContacts($folderId = null, $options = array())
40
    {
41
        if (!$folderId) {
42
            $folderId = $this->getFolderId();
43
        }
44
45
        $request = array(
46
            'Traversal' => 'Shallow',
47
            'ItemShape' => array(
48
                'BaseShape' => 'AllProperties'
49
            ),
50
            'ParentFolderIds' => array(
51
                'FolderId' => $folderId->toXmlObject()
52
            )
53
        );
54
55
        $request = array_replace_recursive($request, $options);
56
57
        $request = Type::buildFromArray($request);
58
59
        return $this->getClient()->FindItem($request);
60
    }
61
62
    /**
63
     * @param Type\ItemIdType $itemId

src/API.php 1 location

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