Code Duplication    Length = 9-13 lines in 4 locations

src/psalm-refactor.php 1 location

@@ 129-137 (lines=9) @@
126
127
$current_dir = (string)getcwd() . DIRECTORY_SEPARATOR;
128
129
if (isset($options['r']) && is_string($options['r'])) {
130
    $root_path = realpath($options['r']);
131
132
    if (!$root_path) {
133
        die('Could not locate root directory ' . $current_dir . DIRECTORY_SEPARATOR . $options['r'] . PHP_EOL);
134
    }
135
136
    $current_dir = $root_path . DIRECTORY_SEPARATOR;
137
}
138
139
$vendor_dir = getVendorDir($current_dir);
140

src/psalm-language-server.php 1 location

@@ 179-191 (lines=13) @@
176
177
$current_dir = (string)getcwd() . DIRECTORY_SEPARATOR;
178
179
if (isset($options['r']) && is_string($options['r'])) {
180
    $root_path = realpath($options['r']);
181
182
    if (!$root_path) {
183
        fwrite(
184
            STDERR,
185
            'Could not locate root directory ' . $current_dir . DIRECTORY_SEPARATOR . $options['r'] . PHP_EOL
186
        );
187
        exit(1);
188
    }
189
190
    $current_dir = $root_path . DIRECTORY_SEPARATOR;
191
}
192
193
$vendor_dir = getVendorDir($current_dir);
194

src/psalm.php 1 location

@@ 199-211 (lines=13) @@
196
197
$current_dir = (string)getcwd() . DIRECTORY_SEPARATOR;
198
199
if (isset($options['r']) && is_string($options['r'])) {
200
    $root_path = realpath($options['r']);
201
202
    if (!$root_path) {
203
        fwrite(
204
            STDERR,
205
            'Could not locate root directory ' . $current_dir . DIRECTORY_SEPARATOR . $options['r'] . PHP_EOL
206
        );
207
        exit(1);
208
    }
209
210
    $current_dir = $root_path . DIRECTORY_SEPARATOR;
211
}
212
213
$path_to_config = get_path_to_config($options);
214

src/psalter.php 1 location

@@ 177-185 (lines=9) @@
174
175
$current_dir = (string)getcwd() . DIRECTORY_SEPARATOR;
176
177
if (isset($options['r']) && is_string($options['r'])) {
178
    $root_path = realpath($options['r']);
179
180
    if (!$root_path) {
181
        die('Could not locate root directory ' . $current_dir . DIRECTORY_SEPARATOR . $options['r'] . PHP_EOL);
182
    }
183
184
    $current_dir = $root_path . DIRECTORY_SEPARATOR;
185
}
186
187
$vendor_dir = getVendorDir($current_dir);
188