install accesses the super-global variable $_SERVER. Open
public static function install(\Composer\Script\Event $event): void
{
$rootDir = realpath(__DIR__ . '/../../');
if (!\defined('ROOT_DIRECTORY')) {
\define('ROOT_DIRECTORY', $rootDir);
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
Function clear
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
public static function clear(): void
{
if ('TEST' === getenv('INSTALL_MODE')) {
return;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function install
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public static function install(\Composer\Script\Event $event): void
{
$rootDir = realpath(__DIR__ . '/../../');
if (!\defined('ROOT_DIRECTORY')) {
\define('ROOT_DIRECTORY', $rootDir);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method install
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function install(\Composer\Script\Event $event): void
{
$rootDir = realpath(__DIR__ . '/../../');
if (!\defined('ROOT_DIRECTORY')) {
\define('ROOT_DIRECTORY', $rootDir);
Method clear
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function clear(): void
{
if ('TEST' === getenv('INSTALL_MODE')) {
return;
}
The method clear() has an NPath complexity of 572. The configured NPath complexity threshold is 200. Open
public static function clear(): void
{
if ('TEST' === getenv('INSTALL_MODE')) {
return;
}
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method clear() has a Cyclomatic Complexity of 19. The configured cyclomatic complexity threshold is 10. Open
public static function clear(): void
{
if ('TEST' === getenv('INSTALL_MODE')) {
return;
}
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method install() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. Open
public static function install(\Composer\Script\Event $event): void
{
$rootDir = realpath(__DIR__ . '/../../');
if (!\defined('ROOT_DIRECTORY')) {
\define('ROOT_DIRECTORY', $rootDir);
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
Refactor this function to reduce its Cognitive Complexity from 22 to the 15 allowed. Open
public static function install(\Composer\Script\Event $event): void
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Refactor this function to reduce its Cognitive Complexity from 34 to the 15 allowed. Open
public static function clear(): void
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Missing class import via use statement (line '253', column '18'). Open
$objects = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($rootDir), \RecursiveIteratorIterator::SELF_FIRST);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '181', column '48'). Open
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($src, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '274', column '20'). Open
foreach (new \DirectoryIterator($level2->getPathname()) as $level3) {
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '272', column '18'). Open
foreach (new \DirectoryIterator($level1->getPathname()) as $level2) {
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '181', column '17'). Open
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($src, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '270', column '16'). Open
foreach (new \DirectoryIterator($rootDir) as $level1) {
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '253', column '49'). Open
$objects = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($rootDir), \RecursiveIteratorIterator::SELF_FIRST);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid using static access to class '\App\Json' in method 'parseCreditsVue'. Open
\App\Json::save($rootDir . 'app_data' . \DIRECTORY_SEPARATOR . 'libraries.json', $dataEncode);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Installer\Credits' in method 'parseCreditsVue'. Open
$dataEncode = Credits::getYarnLibraries($dirLibraries . '.yarn-integrity', $dirLibraries);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method parseCreditsVue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
echo str_repeat('+', 50) . PHP_EOL;
echo 'The problem occured when generating app_data/libraries.json file!!!' . PHP_EOL;
echo 'It is required to run yarn first and then the composer.' . PHP_EOL;
echo 'Example: https://github.com/YetiForceCompany/YetiForceCRM/blob/developer/tests/setup/dependency.sh' . PHP_EOL;
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\vtlib\Functions' in method 'clear'. Open
\vtlib\Functions::recurseDelete($level3->getPathname(), true);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\vtlib\Functions' in method 'customCopy'. Open
$i = \vtlib\Functions::recurseCopy($src, $dest);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\vtlib\Functions' in method 'clear'. Open
\vtlib\Functions::recurseDelete($delete, true);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Define a constant instead of duplicating this literal "/../../" 3 times. Open
$rootDir = realpath(__DIR__ . '/../../');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Assigning array{yetiforce/csrf-magic:'move',maximebf/debugbar:'move',yetiforce/yetiforcepdf/lib/Fonts:'copy',ckeditor/ckeditor:'move'}
to property but \App\Installer\Composer::$publicPackage
is \App\Installer\atring[]
Open
public static $publicPackage = [
- Exclude checks
Call to method getComposer
from undeclared class \Composer\Script\Event
Open
$event->getComposer();
- Exclude checks
Parameter $event
has undeclared type \Composer\Script\Event
Open
public static function install(\Composer\Script\Event $event): void
- Exclude checks
Property \App\Installer\Composer::$publicPackage
has undeclared type \App\Installer\atring[]
(Did you mean string) Open
public static $publicPackage = [
- Exclude checks
Avoid variables with short names like $i. Configured minimum length is 3. Open
$i = \vtlib\Functions::recurseCopy($src, $dest);
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $i. Configured minimum length is 3. Open
$i = 0;
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Spaces must be used to indent lines; tabs are not allowed Open
'ckeditor/ckeditor' => 'move',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'.editorconfig',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'security.md',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'maintenance',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sonar-project.properties',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'changelog.htm',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'bin',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'symfony/console' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\defined('ROOT_DIRECTORY')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!is_dir($publicDir . $item->getPath())) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('move' === $method) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\rename($item->getRealPath(), $publicDir . $item->getPathname());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* List of public packages.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $clearFiles = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'.php_cs.dist',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'upgrade.md',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'whatsnew',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'cldr-version.txt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'smarty_3.1_notes.txt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'phpoffice/phpspreadsheet' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'bin',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$src = 'vendor' . \DIRECTORY_SEPARATOR . $package;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'.gitignore',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'smarty_2_bc_notes.txt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sabre/http' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::clear();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'phpunit.xml.dist',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'js-test',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'migrations',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'phorum',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'inheritance_release_notes.txt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'new_features.txt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'.coveralls.yml',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'views',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'smarty_3.0_bc_notes.txt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'test-settings.sample.php',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'install.fr.utf8',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'phpdoc.ini',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'drupal_test.sh',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (static::$publicPackage as $package => $method) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'tests',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'readme.txt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $clearVendorFiles = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'yii',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rootDir = realpath(__DIR__ . '/../../');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($_SERVER['SENSIOLABS_EXECUTION_NAME'])) {
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
if ($item->isFile() && \in_array($item->getExtension(), $types) && !file_exists($publicDir . $item->getPathname())) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'yetiforce/yetiforcepdf/lib/Fonts' => 'copy',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'.dependabot',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'.travis.yml',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'readme.md',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'demo',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'release2-tag.php',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'crowdin.yml',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'changes.md',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'news',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'composer_release_notes.txt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'debug',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'bin',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'bin',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $copyDirectories = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param \Composer\Script\Event $event
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$event->getComposer();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$list = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($dataEncode) {
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
$objects = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($rootDir), \RecursiveIteratorIterator::SELF_FIRST);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($objects as $object) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (new \DirectoryIterator($level1->getPathname()) as $level2) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($level2->isDir() && !$level2->isDot()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var atring[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $publicPackage = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'.styleci.yml',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'.scrutinizer.yml',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'phpunit.xml',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'get_oauth_token.php',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'release1-update.php',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'makefile',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'twig/twig' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$i = 0;
- Exclude checks
Line exceeds 120 characters; contains 182 characters Open
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($src, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!is_writable($publicDir . $item->getPath())) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dirLibraries = $rootDir . 'public_html' . \DIRECTORY_SEPARATOR . 'src' . \DIRECTORY_SEPARATOR . 'node_modules' . \DIRECTORY_SEPARATOR;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo 'The problem occured when generating app_data/libraries.json file!!!' . PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo "Copy to public_html: $list" . PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$list = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'yetiforce/csrf-magic' => 'move',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'docs',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'extras',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'tutorial',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'change_log.txt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sabre/dav' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo 'It is required to run yarn first and then the composer.' . PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo "Copy custom directories: $list" . PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('.' === $object->getFilename() || '..' === $object->getFilename()) {
- Exclude checks
Line exceeds 120 characters; contains 160 characters Open
if ((\in_array(strtolower($object->getFilename()), self::$clearFiles)) && (is_dir($object->getPathname()) || file_exists($object->getPathname()))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$deleted[] = $object->getPathname();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($deleted as $delete) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\vtlib\Functions::recurseDelete($level3->getPathname(), true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'.github',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'.git',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'.gitkeep',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'mkdocs.yml',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'changelog.md',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'wysiwyg',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'_translationstatus.txt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'test-settings.travis.php',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$types = ['js', 'css', 'woff', 'woff2', 'ttf', 'png', 'gif', 'jpg', 'json', 'svg'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Parse credits vue.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo 'Generated file app_data/libraries.json | ' . \count($dataEncode) . PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo 'Example: https://github.com/YetiForceCompany/YetiForceCRM/blob/developer/tests/setup/dependency.sh' . PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($level1->isDir() && !$level1->isDot()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'.gitattributes',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'build.xml',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'contributing.md',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'examples',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'todo',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'metadata-version.txt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'news.txt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Clear vendor files.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sabre/xml' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sonata-project/google-authenticator' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function install(\Composer\Script\Event $event): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\copy($item->getRealPath(), $publicDir . $item->getPathname());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (static::$copyDirectories as $src => $dest) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rootDir = realpath(__DIR__ . '/../../') . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$deleted = array_unique($deleted);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sample',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'modx.txt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'FAQ.htm',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sabre/vobject' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'bin',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$list .= PHP_EOL . "{$package}[{$method}]: $i";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\vtlib\Functions::recurseDelete($delete, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'maximebf/debugbar' => 'move',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ezyang/htmlpurifier' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'resources',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'doc',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Copy directories.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$publicDir = $rootDir . \DIRECTORY_SEPARATOR . 'public_html' . \DIRECTORY_SEPARATOR;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($item->isFile() && \in_array($item->getExtension(), $types) && !file_exists($publicDir . $item->getPathname())) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
mkdir($publicDir . $item->getPath(), 0755, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::customCopy();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Json::save($rootDir . 'app_data' . \DIRECTORY_SEPARATOR . 'libraries.json', $dataEncode);
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
echo 'Example: https://github.com/YetiForceCompany/YetiForceCRM/blob/developer/tests/setup/dependency.sh' . PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function customCopy(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
mkdir(ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . $dest, 0755, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$i = \vtlib\Functions::recurseCopy($src, $dest);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$deleted = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
arsort($deleted);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (new \DirectoryIterator($rootDir) as $level1) {
- Exclude checks
Line exceeds 120 characters; contains 270 characters Open
if (isset(self::$clearVendorFiles[$level1->getFileName() . '/' . $level2->getFilename()]) && !$level3->isDot() && \in_array(strtolower($level3->getFilename()), self::$clearVendorFiles[$level1->getFileName() . '/' . $level2->getFilename()])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* List of redundant files.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'.npm',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'changelog.phpexcel.md',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'doc',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'samples',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'test',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'jquery.min.js',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'whitesource.config.json',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'illuminate/support' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sabre/event' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'yetiforce/yii2' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Post update and post install function.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\define('ROOT_DIRECTORY', $rootDir);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo str_repeat('=', 50) . PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
continue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('copy' === $method) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo str_repeat('-', 50) . PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Custom copy.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset(self::$clearVendorFiles[$level1->getFileName() . '/' . $level2->getFilename()]) && !$level3->isDot() && \in_array(strtolower($level3->getFilename()), self::$clearVendorFiles[$level1->getFileName() . '/' . $level2->getFilename()])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo str_repeat('=', 50) . PHP_EOL;
- Exclude checks
Line exceeds 120 characters; contains 143 characters Open
$dirLibraries = $rootDir . 'public_html' . \DIRECTORY_SEPARATOR . 'src' . \DIRECTORY_SEPARATOR . 'node_modules' . \DIRECTORY_SEPARATOR;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ((\in_array(strtolower($object->getFilename()), self::$clearFiles)) && (is_dir($object->getPathname()) || file_exists($object->getPathname()))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$i;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataEncode = Credits::getYarnLibraries($dirLibraries . '.yarn-integrity', $dirLibraries);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$list .= PHP_EOL . "{$src} >>> {$dest} | Files: $i";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Delete redundant files.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('TEST' === getenv('INSTALL_MODE')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo str_repeat('-', 50) . PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::parseCreditsVue();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo str_repeat('+', 50) . PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'install',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'readme',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'.sami.php',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'plugins',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'bin',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($src, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function parseCreditsVue(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
continue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$deletedCount;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo str_repeat('-', 50) . PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rootDir = realpath(__DIR__ . '/../../') . \DIRECTORY_SEPARATOR;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo "Cleaned files: $deletedCount" . PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!file_exists(ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . $dest)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function clear(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$objects = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($rootDir), \RecursiveIteratorIterator::SELF_FIRST);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (new \DirectoryIterator($level2->getPathname()) as $level3) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo str_repeat('+', 50) . PHP_EOL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$deletedCount = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$deletedCount;
- Exclude checks