Code Duplication    Length = 22-23 lines in 2 locations

src/API.php 1 location

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

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