private static function PathChecker::duplicateCheck in Optimizely 8.0
Same name and namespace in other branches
- 8 src/PathChecker.php \Drupal\optimizely\PathChecker::duplicateCheck()
1 call to PathChecker::duplicateCheck()
- PathChecker::uniquePaths in src/PathChecker.php
File
- src/PathChecker.php, line 258
- Contains \Drupal\optimizely\src\PathChecker
Class
- PathChecker
- Provides static methods to check path validity, etc.
Namespace
Drupal\optimizely
Code
private static function duplicateCheck($paths) {
$unreviewed_paths = $paths;
foreach ($paths as $path) {
array_shift($unreviewed_paths);
if (strpos($path, '*') !== FALSE) {
if (strpos($path, '*') !== 0) {
$path = substr($path, 0, -2);
foreach ($unreviewed_paths as $unreviewed_path) {
if (strpos($unreviewed_path, $path) !== FALSE) {
return $path . '/*';
}
}
}
elseif (strpos($path, '*') === 0 && count($paths) > 1) {
return $path;
}
}
elseif (in_array($path, $unreviewed_paths)) {
return $path;
}
}
return FALSE;
}