Code Duplication    Length = 23-23 lines in 2 locations

src/API.php 2 locations

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