Code Duplication    Length = 23-23 lines in 2 locations

src/API.php 2 locations

@@ 90-112 (lines=23) @@
87
            ->getFieldUrisFromClass(DictionaryURIType::class);
88
    }
89
90
    public function getFieldUriByName($fieldName, $preference = 'item')
91
    {
92
        $fieldName = strtolower($fieldName);
93
        $preference = strtolower($preference);
94
95
        if (empty($this->unIndexedFieldUris)) {
96
            $this->setupFieldUris();
97
        }
98
99
        if (!isset($this->unIndexedFieldUris[$fieldName])) {
100
            return false;
101
        }
102
103
        if (!isset($this->unIndexedFieldUris[$fieldName][$preference])) {
104
            $preference = 'item';
105
        }
106
107
        if (!isset($this->unIndexedFieldUris[$fieldName][$preference])) {
108
            throw new ExchangeException("Could not find uri $preference:$fieldName");
109
        }
110
111
        return $this->unIndexedFieldUris[$fieldName][$preference];
112
    }
113
114
    public function getIndexedFieldUriByName($fieldName, $preference = 'item')
115
    {
@@ 114-136 (lines=23) @@
111
        return $this->unIndexedFieldUris[$fieldName][$preference];
112
    }
113
114
    public function getIndexedFieldUriByName($fieldName, $preference = 'item')
115
    {
116
        $fieldName = strtolower($fieldName);
117
        $preference = strtolower($preference);
118
119
        if (empty($this->dictionaryFieldUris)) {
120
            $this->setupFieldUris();
121
        }
122
123
        if (!isset($this->dictionaryFieldUris[$fieldName])) {
124
            return false;
125
        }
126
127
        if (!isset($this->dictionaryFieldUris[$fieldName][$preference])) {
128
            $preference = 'item';
129
        }
130
131
        if (!isset($this->dictionaryFieldUris[$fieldName][$preference])) {
132
            throw new ExchangeException("Could not find uri $preference:$fieldName");
133
        }
134
135
        return $this->dictionaryFieldUris[$fieldName][$preference];
136
    }
137
138
    /**
139
     * Get a calendar item