Code Duplication    Length = 17-17 lines in 2 locations

src/ServiceProvider.php 1 location

@@ 162-178 (lines=17) @@
159
     *
160
     * @return array
161
     */
162
    protected function getSlugSources($from): array
163
    {
164
        if (is_null($from)) {
165
            return [$this->model->__toString()];
166
        }
167
168
        $sourceStrings = array_map(function ($key) {
169
            $value = data_get($this->model, $key);
170
            if (is_bool($value)) {
171
                $value = (int) $value;
172
            }
173
174
            return $value;
175
        }, (array) $from);
176
177
        return $sourceStrings;
178
    }
179
180
    /**
181
     * Generate a slug from the given source string.

src/Services/SlugService.php 1 location

@@ 148-164 (lines=17) @@
145
     *
146
     * @return array
147
     */
148
    protected function getSlugSources($from): array
149
    {
150
        if (is_null($from)) {
151
            return $this->model->__toString();
152
        }
153
154
        $sourceStrings = array_map(function ($key) {
155
            $value = data_get($this->model, $key);
156
            if (is_bool($value)) {
157
                $value = (int) $value;
158
            }
159
160
            return $value;
161
        }, (array) $from);
162
163
        return $sourceStrings;
164
    }
165
166
    /**
167
     * Generate a slug from the given source string.