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

@@ 334-356 (lines=23) @@
331
     * @param array $options
332
     * @return Type\BaseFolderType[]
333
     */
334
    public function getChildrenFolders($parentFolderId = 'root', $options = array())
335
    {
336
        if (is_string($parentFolderId)) {
337
            $parentFolderId = $this->getFolderByDistinguishedId($parentFolderId)->getFolderId();
338
        }
339
340
        $request = array(
341
            'Traversal' => 'Shallow',
342
            'FolderShape' => array(
343
                'BaseShape' => 'AllProperties'
344
            ),
345
            'ParentFolderIds' => array(
346
                'FolderId' => $parentFolderId->toArray()
347
            )
348
        );
349
350
        $request = array_replace_recursive($request, $options);
351
352
        $request = Type::buildFromArray($request);
353
354
        /** @var \garethp\ews\API\Message\FindFolderResponseMessageType $folders */
355
        return $this->getClient()->FindFolder($request);
356
    }
357
358
    /**
359
     * @param string $folderName