Skip to content

Commit 2fb0343

Browse files
committed
remove all reference to DS contant
1 parent 25757f0 commit 2fb0343

38 files changed

+111
-111
lines changed

src/Cache/CacheEngine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public function key($key)
251251
$prefix = vsprintf($this->_groupPrefix, $this->groups());
252252
}
253253

254-
$key = preg_replace('/[\s]+/', '_', strtolower(trim(str_replace([DS, '/', '.'], '_', strval($key)))));
254+
$key = preg_replace('/[\s]+/', '_', strtolower(trim(str_replace([DIRECTORY_SEPARATOR, '/', '.'], '_', strval($key)))));
255255
return $prefix . $key;
256256
}
257257

src/Cache/Engine/FileEngine.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,16 @@ public function init(array $config = [])
9191
parent::init($config);
9292

9393
if ($this->_config['path'] === null) {
94-
$this->_config['path'] = sys_get_temp_dir() . DS . 'cake_cache' . DS;
94+
$this->_config['path'] = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'cake_cache' . DIRECTORY_SEPARATOR;
9595
}
96-
if (DS === '\\') {
96+
if (DIRECTORY_SEPARATOR === '\\') {
9797
$this->_config['isWindows'] = true;
9898
}
99-
if (substr($this->_config['path'], -1) !== DS) {
100-
$this->_config['path'] .= DS;
99+
if (substr($this->_config['path'], -1) !== DIRECTORY_SEPARATOR) {
100+
$this->_config['path'] .= DIRECTORY_SEPARATOR;
101101
}
102102
if (!empty($this->_groupPrefix)) {
103-
$this->_groupPrefix = str_replace('_', DS, $this->_groupPrefix);
103+
$this->_groupPrefix = str_replace('_', DIRECTORY_SEPARATOR, $this->_groupPrefix);
104104
}
105105
return $this->_active();
106106
}
@@ -279,7 +279,7 @@ public function clear($check)
279279
continue;
280280
}
281281

282-
$path = $path->getRealPath() . DS;
282+
$path = $path->getRealPath() . DIRECTORY_SEPARATOR;
283283
if (!in_array($path, $cleared)) {
284284
$this->_clearDirectory($path, $now, $threshold);
285285
$cleared[] = $path;
@@ -445,7 +445,7 @@ public function key($key)
445445
}
446446

447447
$key = Inflector::underscore(str_replace(
448-
[DS, '/', '.', '<', '>', '?', ':', '|', '*', '"'],
448+
[DIRECTORY_SEPARATOR, '/', '.', '<', '>', '?', ':', '|', '*', '"'],
449449
'_',
450450
strval($key)
451451
));
@@ -467,7 +467,7 @@ public function clearGroup($group)
467467
RecursiveIteratorIterator::CHILD_FIRST
468468
);
469469
foreach ($contents as $object) {
470-
$containsGroup = strpos($object->getPathname(), DS . $group . DS) !== false;
470+
$containsGroup = strpos($object->getPathname(), DIRECTORY_SEPARATOR . $group . DIRECTORY_SEPARATOR) !== false;
471471
$hasPrefix = true;
472472
if (strlen($this->_config['prefix']) !== 0) {
473473
$hasPrefix = strpos($object->getBasename(), $this->_config['prefix']) === 0;

src/Console/ConsoleOutput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public function __construct($stream = 'php://stdout')
163163
{
164164
$this->_output = fopen($stream, 'w');
165165

166-
if ((DS === '\\' && !(bool)env('ANSICON') && env('ConEmuANSI') !== 'ON') ||
166+
if ((DIRECTORY_SEPARATOR === '\\' && !(bool)env('ANSICON') && env('ConEmuANSI') !== 'ON') ||
167167
(function_exists('posix_isatty') && !posix_isatty($this->_output))
168168
) {
169169
$this->_outputAs = self::PLAIN;

src/Console/Shell.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ public function error($title, $message = null, $exitCode = self::CODE_ERROR)
762762
public function clear()
763763
{
764764
if (empty($this->params['noclear'])) {
765-
if (DS === '/') {
765+
if (DIRECTORY_SEPARATOR === '/') {
766766
passthru('clear');
767767
} else {
768768
passthru('cls');
@@ -780,7 +780,7 @@ public function clear()
780780
*/
781781
public function createFile($path, $contents)
782782
{
783-
$path = str_replace(DS . DS, DS, $path);
783+
$path = str_replace(DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, $path);
784784

785785
$this->_io->out();
786786

@@ -826,9 +826,9 @@ public function createFile($path, $contents)
826826
public function shortPath($file)
827827
{
828828
$shortPath = str_replace(ROOT, null, $file);
829-
$shortPath = str_replace('..' . DS, '', $shortPath);
830-
$shortPath = str_replace(DS, '/', $shortPath);
831-
return str_replace('//', DS, $shortPath);
829+
$shortPath = str_replace('..' . DIRECTORY_SEPARATOR, '', $shortPath);
830+
$shortPath = str_replace(DIRECTORY_SEPARATOR, '/', $shortPath);
831+
return str_replace('//', DIRECTORY_SEPARATOR, $shortPath);
832832
}
833833

834834
/**

src/Controller/Component/RequestHandlerComponent.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,11 +564,11 @@ public function renderAs(Controller $controller, $type, array $options = [])
564564
$builder->className($viewClass);
565565
} else {
566566
if (empty($this->_renderType)) {
567-
$builder->templatePath($builder->templatePath() . DS . $type);
567+
$builder->templatePath($builder->templatePath() . DIRECTORY_SEPARATOR . $type);
568568
} else {
569569
$builder->templatePath(preg_replace(
570570
"/([\/\\\\]{$this->_renderType})$/",
571-
DS . $type,
571+
DIRECTORY_SEPARATOR . $type,
572572
$builder->templatePath()
573573
));
574574
}

src/Controller/Controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ protected function _viewPath()
625625
'Cake\Utility\Inflector::camelize',
626626
explode('/', $this->request->params['prefix'])
627627
);
628-
$viewPath = implode(DS, $prefixes) . DS . $viewPath;
628+
$viewPath = implode(DIRECTORY_SEPARATOR, $prefixes) . DIRECTORY_SEPARATOR . $viewPath;
629629
}
630630
return $viewPath;
631631
}

src/Core/App.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,9 @@ public static function path($type, $plugin = null)
186186
return (array)Configure::read('App.paths.templates');
187187
}
188188
if (!empty($plugin)) {
189-
return [Plugin::classPath($plugin) . $type . DS];
189+
return [Plugin::classPath($plugin) . $type . DIRECTORY_SEPARATOR];
190190
}
191-
return [APP . $type . DS];
191+
return [APP . $type . DIRECTORY_SEPARATOR];
192192
}
193193

194194
/**
@@ -207,6 +207,6 @@ public static function path($type, $plugin = null)
207207
*/
208208
public static function core($type)
209209
{
210-
return [CAKE . str_replace('/', DS, $type) . DS];
210+
return [CAKE . str_replace('/', DIRECTORY_SEPARATOR, $type) . DIRECTORY_SEPARATOR];
211211
}
212212
}

src/Core/ClassLoader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ public function addNamespace($prefix, $baseDir, $prepend = false)
5353
{
5454
$prefix = trim($prefix, '\\') . '\\';
5555

56-
$baseDir = rtrim($baseDir, '/') . DS;
57-
$baseDir = rtrim($baseDir, DS) . '/';
56+
$baseDir = rtrim($baseDir, '/') . DIRECTORY_SEPARATOR;
57+
$baseDir = rtrim($baseDir, DIRECTORY_SEPARATOR) . '/';
5858

5959
if (!isset($this->_prefixes[$prefix])) {
6060
$this->_prefixes[$prefix] = [];
@@ -108,7 +108,7 @@ protected function _loadMappedFile($prefix, $relativeClass)
108108
}
109109

110110
foreach ($this->_prefixes[$prefix] as $baseDir) {
111-
$file = $baseDir . str_replace('\\', DS, $relativeClass) . '.php';
111+
$file = $baseDir . str_replace('\\', DIRECTORY_SEPARATOR, $relativeClass) . '.php';
112112

113113
if ($this->_requireFile($file)) {
114114
return $file;

src/Core/ConventionsTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ protected function _pluginPath($pluginName)
136136
if (Plugin::loaded($pluginName)) {
137137
return Plugin::path($pluginName);
138138
}
139-
return current(App::path('Plugin')) . $pluginName . DS;
139+
return current(App::path('Plugin')) . $pluginName . DIRECTORY_SEPARATOR;
140140
}
141141

142142
/**

src/Core/Plugin.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ public static function load($plugin, array $config = [])
135135

136136
if (empty($config['path'])) {
137137
$paths = App::path('Plugin');
138-
$pluginPath = str_replace('/', DS, $plugin);
138+
$pluginPath = str_replace('/', DIRECTORY_SEPARATOR, $plugin);
139139
foreach ($paths as $path) {
140140
if (is_dir($path . $pluginPath)) {
141-
$config['path'] = $path . $pluginPath . DS;
141+
$config['path'] = $path . $pluginPath . DIRECTORY_SEPARATOR;
142142
break;
143143
}
144144
}
@@ -148,9 +148,9 @@ public static function load($plugin, array $config = [])
148148
throw new MissingPluginException(['plugin' => $plugin]);
149149
}
150150

151-
$config['classPath'] = $config['path'] . $config['classBase'] . DS;
151+
$config['classPath'] = $config['path'] . $config['classBase'] . DIRECTORY_SEPARATOR;
152152
if (!isset($config['configPath'])) {
153-
$config['configPath'] = $config['path'] . 'config' . DS;
153+
$config['configPath'] = $config['path'] . 'config' . DIRECTORY_SEPARATOR;
154154
}
155155

156156
static::$_plugins[$plugin] = $config;
@@ -162,11 +162,11 @@ public static function load($plugin, array $config = [])
162162
}
163163
static::$_loader->addNamespace(
164164
str_replace('/', '\\', $plugin),
165-
$config['path'] . $config['classBase'] . DS
165+
$config['path'] . $config['classBase'] . DIRECTORY_SEPARATOR
166166
);
167167
static::$_loader->addNamespace(
168168
str_replace('/', '\\', $plugin) . '\Test',
169-
$config['path'] . 'tests' . DS
169+
$config['path'] . 'tests' . DIRECTORY_SEPARATOR
170170
);
171171
}
172172

@@ -185,9 +185,9 @@ protected static function _loadConfig()
185185
if (Configure::check('plugins')) {
186186
return;
187187
}
188-
$vendorFile = dirname(dirname(__DIR__)) . DS . 'cakephp-plugins.php';
188+
$vendorFile = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'cakephp-plugins.php';
189189
if (!file_exists($vendorFile)) {
190-
$vendorFile = dirname(dirname(dirname(dirname(__DIR__)))) . DS . 'cakephp-plugins.php';
190+
$vendorFile = dirname(dirname(dirname(dirname(__DIR__)))) . DIRECTORY_SEPARATOR . 'cakephp-plugins.php';
191191
if (!file_exists($vendorFile)) {
192192
Configure::write(['plugins' => []]);
193193
return;

0 commit comments

Comments
 (0)