Code style fixes (DIRECTORY_SEPARATOR -> '/').

This commit is contained in:
Dmitry Khomutov 2018-03-08 10:31:31 +07:00
commit ba11827340
No known key found for this signature in database
GPG key ID: EC19426474B37AAC
17 changed files with 50 additions and 46 deletions

View file

@ -146,7 +146,7 @@ class BuildController extends Controller
protected function getUiPlugins()
{
$rtn = [];
$path = PUBLIC_DIR . 'assets' . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . 'build-plugins' . DIRECTORY_SEPARATOR;
$path = PUBLIC_DIR . 'assets/js/build-plugins/';
$dir = opendir($path);
while ($item = readdir($dir)) {

View file

@ -335,14 +335,14 @@ class CommandExecutor implements CommandExecutorInterface
public function getComposerBinDir($path)
{
if (is_dir($path)) {
$composer = $path . DIRECTORY_SEPARATOR . 'composer.json';
$composer = $path . '/composer.json';
if (is_file($composer)) {
$json = json_decode(file_get_contents($composer));
if (isset($json->config->{"bin-dir"})) {
return $path . DIRECTORY_SEPARATOR . $json->config->{"bin-dir"};
} elseif (is_dir($path . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'bin')) {
return $path . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'bin';
return $path . '/' . $json->config->{"bin-dir"};
} elseif (is_dir($path . '/vendor/bin')) {
return $path . '/vendor/bin';
}
}
}

View file

@ -101,7 +101,7 @@ class Lang
{
$languages = [];
foreach (self::$languages as $language) {
$strings = include(SRC_DIR . 'Languages' . DIRECTORY_SEPARATOR . 'lang.' . $language . '.php');
$strings = include(SRC_DIR . 'Languages/lang.' . $language . '.php');
$languages[$language] = !empty($strings['language_name'])
? $strings['language_name'] . ' (' . $language . ')'
: $language;
@ -169,7 +169,7 @@ class Lang
? $language
: self::$language;
$langFile = SRC_DIR . 'Languages' . DIRECTORY_SEPARATOR . 'lang.' . $language . '.php';
$langFile = SRC_DIR . 'Languages/lang.' . $language . '.php';
if (!file_exists($langFile)) {
return null;
@ -189,7 +189,7 @@ class Lang
protected static function loadAvailableLanguages()
{
$matches = [];
foreach (glob(SRC_DIR . 'Languages' . DIRECTORY_SEPARATOR . 'lang.*.php') as $file) {
foreach (glob(SRC_DIR . 'Languages/lang.*.php') as $file) {
if (preg_match('/lang\.([a-z]{2}\-?[a-z]*)\.php/', $file, $matches)) {
self::$languages[] = $matches[1];
}

View file

@ -790,7 +790,7 @@ class Build extends Model
*/
protected function getZeroConfigPlugins(Builder $builder)
{
$pluginDir = SRC_DIR . 'Plugin' . DIRECTORY_SEPARATOR;
$pluginDir = SRC_DIR . 'Plugin/';
$dir = new \DirectoryIterator($pluginDir);
$config = [

View file

@ -47,7 +47,7 @@ class Atoum extends Plugin
parent::__construct($builder, $build, $options);
if (isset($options['executable'])) {
$this->executable = $this->builder->buildPath . DIRECTORY_SEPARATOR.$options['executable'];
$this->executable = $this->builder->buildPath . '/' . $options['executable'];
} else {
$this->executable = $this->findBinary('atoum');
}
@ -83,7 +83,7 @@ class Atoum extends Plugin
}
if ($this->directory !== null) {
$dirPath = $this->builder->buildPath . DIRECTORY_SEPARATOR . $this->directory;
$dirPath = $this->builder->buildPath . '/' . $this->directory;
$cmd .= " -d '{$dirPath}'";
}

View file

@ -46,7 +46,7 @@ class Composer extends Plugin implements ZeroConfigPluginInterface
$this->ignorePlatformReqs = false;
if (array_key_exists('directory', $options)) {
$this->directory = $path . DIRECTORY_SEPARATOR . $options['directory'];
$this->directory = $path . '/' . $options['directory'];
}
if (array_key_exists('action', $options)) {
@ -80,7 +80,7 @@ class Composer extends Plugin implements ZeroConfigPluginInterface
*/
public static function canExecute($stage, Builder $builder, Build $build)
{
$path = $builder->buildPath . DIRECTORY_SEPARATOR . 'composer.json';
$path = $builder->buildPath . '/composer.json';
if (file_exists($path) && $stage == Build::STAGE_SETUP) {
return true;

View file

@ -8,7 +8,7 @@ use PHPCensor\Plugin;
/**
* Grunt Plugin - Provides access to grunt functionality.
*
*
* @author Tobias Tom <t.tom@succont.de>
*/
class Grunt extends Plugin
@ -26,14 +26,14 @@ class Grunt extends Plugin
{
return 'grunt';
}
/**
* {@inheritdoc}
*/
public function __construct(Builder $builder, Build $build, array $options = [])
{
parent::__construct($builder, $build, $options);
$path = $this->builder->buildPath;
$this->directory = $path;
$this->task = null;
@ -42,7 +42,7 @@ class Grunt extends Plugin
// Handle options:
if (isset($options['directory'])) {
$this->directory = $path . DIRECTORY_SEPARATOR . $options['directory'];
$this->directory = $path . '/' . $options['directory'];
}
if (isset($options['task'])) {

View file

@ -8,7 +8,7 @@ use PHPCensor\Plugin;
/**
* Gulp Plugin - Provides access to gulp functionality.
*
*
* @author Dirk Heilig <dirk@heilig-online.com>
*/
class Gulp extends Plugin
@ -26,14 +26,14 @@ class Gulp extends Plugin
{
return 'gulp';
}
/**
* {@inheritdoc}
*/
public function __construct(Builder $builder, Build $build, array $options = [])
{
parent::__construct($builder, $build, $options);
$path = $this->builder->buildPath;
$this->directory = $path;
$this->task = null;
@ -42,7 +42,7 @@ class Gulp extends Plugin
// Handle options:
if (isset($options['directory'])) {
$this->directory = $path . DIRECTORY_SEPARATOR . $options['directory'];
$this->directory = $path . '/' . $options['directory'];
}
if (isset($options['task'])) {

View file

@ -9,7 +9,7 @@ use PHPCensor\Plugin;
/**
* PHP Lint Plugin - Provides access to PHP lint functionality.
*
*
* @author Dan Cryer <dan@block8.co.uk>
*/
class Lint extends Plugin
@ -83,7 +83,11 @@ class Lint extends Plugin
if ($item->isFile() && $item->getExtension() == 'php' && !$this->lintFile($php, $itemPath)) {
$success = false;
} elseif ($item->isDir() && $this->recursive && !$this->lintDirectory($php, $itemPath . DIRECTORY_SEPARATOR)) {
} elseif (
$item->isDir() &&
$this->recursive &&
!$this->lintDirectory($php, ($itemPath . '/'))
) {
$success = false;
}

View file

@ -122,9 +122,9 @@ class Pdepend extends Plugin
$success = $this->builder->executeCommand(
$cmd,
$this->buildLocation . DIRECTORY_SEPARATOR . $this->summary,
$this->buildLocation . DIRECTORY_SEPARATOR . $this->chart,
$this->buildLocation . DIRECTORY_SEPARATOR . $this->pyramid,
$this->buildLocation . '/' . $this->summary,
$this->buildLocation . '/' . $this->chart,
$this->buildLocation . '/' . $this->pyramid,
$ignore,
$this->directory
);

View file

@ -178,7 +178,7 @@ class Phar extends Plugin
$content = '';
$filename = $this->getStub();
if ($filename) {
$content = file_get_contents($this->builder->buildPath . DIRECTORY_SEPARATOR . $this->getStub());
$content = file_get_contents($this->builder->buildPath . '/' . $this->getStub());
}
return $content;
}
@ -192,7 +192,7 @@ class Phar extends Plugin
$success = false;
try {
$file = $this->getDirectory() . DIRECTORY_SEPARATOR . $this->getFilename();
$file = $this->getDirectory() . '/' . $this->getFilename();
$phar = new PHPPhar($file, 0, $this->getFilename());
$phar->buildFromDirectory($this->builder->buildPath, $this->getRegExp());

View file

@ -38,7 +38,7 @@ class Phing extends Plugin
* Set working directory
*/
if (isset($options['directory'])) {
$directory = $this->builder->buildPath . DIRECTORY_SEPARATOR . $options['directory'];
$directory = $this->builder->buildPath . '/' . $options['directory'];
} else {
$directory = $this->builder->buildPath;
}
@ -228,7 +228,7 @@ class Phing extends Plugin
*/
public function setPropertyFile($propertyFile)
{
if (!file_exists($this->getDirectory() . DIRECTORY_SEPARATOR . $propertyFile)) {
if (!file_exists($this->getDirectory() . '/' . $propertyFile)) {
throw new \Exception('Specified property file does not exist.');
}

View file

@ -83,8 +83,8 @@ class PhpCpd extends Plugin implements ZeroConfigPluginInterface
$namesExclude = ' --names-exclude ';
foreach ($this->ignore as $item) {
$item = rtrim($item, DIRECTORY_SEPARATOR);
if (is_file(rtrim($this->path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $item)) {
$item = rtrim($item, '/');
if (is_file(rtrim($this->path, '/') . '/' . $item)) {
$ignoredFile = explode('/', $item);
$filesToIgnore[] = array_pop($ignoredFile);
} else {

View file

@ -10,7 +10,7 @@ use PHPCensor\ZeroConfigPluginInterface;
/**
* PHP Loc - Allows PHP Copy / Lines of Code testing.
*
*
* @author Johan van der Heide <info@japaveh.nl>
*/
class PhpLoc extends Plugin implements ZeroConfigPluginInterface
@ -27,7 +27,7 @@ class PhpLoc extends Plugin implements ZeroConfigPluginInterface
{
return 'php_loc';
}
/**
* Check if this plugin can be executed.
* @param $stage
@ -67,7 +67,7 @@ class PhpLoc extends Plugin implements ZeroConfigPluginInterface
if (count($this->builder->ignore)) {
$map = function ($item) {
return ' --exclude ' . rtrim($item, DIRECTORY_SEPARATOR);
return ' --exclude ' . rtrim($item, '/');
};
$ignore = array_map($map, $this->builder->ignore);

View file

@ -127,7 +127,7 @@ class PhpTalLint extends Plugin
if (!$this->lintFile($itemPath)) {
$success = false;
}
} elseif ($item->isDir() && $this->recursive && !$this->lintDirectory($itemPath . DIRECTORY_SEPARATOR)) {
} elseif ($item->isDir() && $this->recursive && !$this->lintDirectory($itemPath . '/')) {
$success = false;
}
@ -174,10 +174,10 @@ class PhpTalLint extends Plugin
list($suffixes, $tales) = $this->getFlags();
$lint = __DIR__ . DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
$lint .= 'vendor' . DIRECTORY_SEPARATOR . 'phptal' . DIRECTORY_SEPARATOR . 'phptal' . DIRECTORY_SEPARATOR;
$lint .= 'tools' . DIRECTORY_SEPARATOR . 'phptal_lint.php';
$cmd = '/usr/bin/env php ' . $lint . ' %s %s "%s"';
$lint = __DIR__ . '/';
$lint .= 'vendor/phptal/phptal/';
$lint .= 'tools/phptal_lint.php';
$cmd = 'php ' . $lint . ' %s %s "%s"';
$this->builder->executeCommand($cmd, $suffixes, $tales, $this->builder->buildPath . $path);

View file

@ -59,7 +59,7 @@ class SecurityChecker extends Plugin implements ZeroConfigPluginInterface
*/
public static function canExecute($stage, Builder $builder, Build $build)
{
$path = $builder->buildPath . DIRECTORY_SEPARATOR . 'composer.lock';
$path = $builder->buildPath . '/composer.lock';
if (file_exists($path) && $stage == Build::STAGE_TEST) {
return true;
@ -72,7 +72,7 @@ class SecurityChecker extends Plugin implements ZeroConfigPluginInterface
{
$success = true;
$checker = new BaseSecurityChecker();
$warnings = $checker->check($this->builder->buildPath . DIRECTORY_SEPARATOR . 'composer.lock');
$warnings = $checker->check($this->builder->buildPath . '/composer.lock');
if ($warnings) {
foreach ($warnings as $library => $warning) {

View file

@ -111,8 +111,8 @@ class XMPP extends Plugin
*/
public function findConfigFile()
{
if (file_exists($this->builder->buildPath . DIRECTORY_SEPARATOR . '.sendxmpprc')) {
if (md5(file_get_contents($this->builder->buildPath . DIRECTORY_SEPARATOR . '.sendxmpprc'))
if (file_exists($this->builder->buildPath . '/.sendxmpprc')) {
if (md5(file_get_contents($this->builder->buildPath . '/.sendxmpprc'))
!== md5($this->getConfigFormat())) {
return null;
}
@ -140,7 +140,7 @@ class XMPP extends Plugin
/*
* Try to build conf file
*/
$config_file = $this->builder->buildPath . DIRECTORY_SEPARATOR . '.sendxmpprc';
$config_file = $this->builder->buildPath . '/.sendxmpprc';
if (is_null($this->findConfigFile())) {
file_put_contents($config_file, $this->getConfigFormat());
chmod($config_file, 0600);
@ -154,7 +154,7 @@ class XMPP extends Plugin
$tls = ' -t';
}
$message_file = $this->builder->buildPath . DIRECTORY_SEPARATOR . uniqid('xmppmessage');
$message_file = $this->builder->buildPath . '/' . uniqid('xmppmessage');
if ($this->buildMessage($message_file) === false) {
return false;
}