Method db
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function db(): array
{
$benchmarkCountGroup = 20;
$insertCountGroup = 5;
$updateCountGroup = 5;
Function hardDrive
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
private static function hardDrive(): array
{
$countGroup = 50;
$maxTime = 0.2;
$read = $write = [];
- 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 db
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
private static function db(): array
{
$benchmarkCountGroup = 20;
$insertCountGroup = 5;
$updateCountGroup = 5;
- 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
File Benchmarks.php
has 297 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Benchmarks file.
*
Function cpu
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private static function cpu(): array
{
$mathFunctions = self::$mathFunctions;
$mathCountGroup = 5000;
$mathMaxTime = 0.3;
- 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 cpu
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function cpu(): array
{
$mathFunctions = self::$mathFunctions;
$mathCountGroup = 5000;
$mathMaxTime = 0.3;
Method hardDrive
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function hardDrive(): array
{
$countGroup = 50;
$maxTime = 0.2;
$read = $write = [];
Method ram
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function ram(): array
{
$mathCountGroup = 1000;
$writeTime = $readTime = $readOperations = $writeOperations = 0;
for ($i = 0; $i < 5; ++$i) {
Function ram
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function ram(): array
{
$mathCountGroup = 1000;
$writeTime = $readTime = $readOperations = $writeOperations = 0;
for ($i = 0; $i < 5; ++$i) {
- 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
The method db() has 120 lines of code. Current threshold is set to 100. Avoid really long methods. Open
private static function db(): array
{
$benchmarkCountGroup = 20;
$insertCountGroup = 5;
$updateCountGroup = 5;
- Exclude checks
The method db() has an NPath complexity of 1152. The configured NPath complexity threshold is 200. Open
private static function db(): array
{
$benchmarkCountGroup = 20;
$insertCountGroup = 5;
$updateCountGroup = 5;
- 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 hardDrive() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10. Open
private static function hardDrive(): array
{
$countGroup = 50;
$maxTime = 0.2;
$read = $write = [];
- 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 cpu() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. Open
private static function cpu(): array
{
$mathFunctions = self::$mathFunctions;
$mathCountGroup = 5000;
$mathMaxTime = 0.3;
- 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 db() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10. Open
private static function db(): array
{
$benchmarkCountGroup = 20;
$insertCountGroup = 5;
$updateCountGroup = 5;
- 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 33 to the 15 allowed. Open
private static function hardDrive(): array
- 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 18 to the 15 allowed. Open
private static function cpu(): array
- 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 25 to the 15 allowed. Open
private static function db(): array
- 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 '277', column '39'). Open
(new \App\Db\Query())->select(new \yii\db\Expression('sql_no_cache *'))->from('benchmark_temp_table')->where(['id' => $lastId])->all();
- 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 '180', column '18'). Open
foreach (new \DirectoryIterator($dirGroup) as $itemGroup) {
- 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 '277', column '10'). Open
(new \App\Db\Query())->select(new \yii\db\Expression('sql_no_cache *'))->from('benchmark_temp_table')->where(['id' => $lastId])->all();
- 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 '182', column '20'). Open
foreach (new \DirectoryIterator($itemGroup->getPathname()) 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
Avoid using static access to class '\App\Log' in method 'hardDrive'. Open
\App\Log::error($e->getMessage() . PHP_EOL . $e->__toString());
- 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\Db' in method 'db'. Open
$db = \App\Db::getInstance();
- 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 'hardDrive'. Open
\vtlib\Functions::recurseDelete('cache/speed');
- 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 "crmid" 3 times. Open
'crmid' => $schema->createColumnSchemaBuilder(\yii\db\Schema::TYPE_INTEGER, 10),
- 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.
Define a constant instead of duplicating this literal "benchmark_temp_table" 7 times. Open
if (!$db->getTableSchema('benchmark_temp_table')) {
- 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.
Define a constant instead of duplicating this literal "profile" 7 times. Open
'profile' => $db->createCommand('SHOW PROFILE')->queryAll(),
- 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.
Define a constant instead of duplicating this literal "operations" 12 times. Open
'operations' => $mathOperations,
- 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.
Define a constant instead of duplicating this literal "string" 4 times. Open
'string' => [
- 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.
Define a constant instead of duplicating this literal "SHOW PROFILE" 7 times. Open
'profile' => $db->createCommand('SHOW PROFILE')->queryAll(),
- 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.
Unused array offset fetch Open
$test[$j];
- Exclude checks
Call to undeclared method \App\Db::getSchema
Open
$schema = $db->getSchema();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
'profile' => $db->createCommand('SHOW PROFILE')->queryAll(),
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$dbCommand = $db->createCommand();
- Exclude checks
Call to undeclared method \App\Db::getTableSchema
Open
if (!$db->getTableSchema('benchmark_temp_table')) {
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand('SELECT BENCHMARK(1000,1+1);')->execute();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
'profile' => $db->createCommand('SHOW PROFILE')->queryAll(),
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
\App\Log::error($e->getMessage() . PHP_EOL . $e->__toString());
- Exclude checks
Reference to constant TYPE_STRING
from undeclared class \yii\db\Schema
(Did you mean class \App\Db\Drivers\Mysql\Schema or class \App\Db\Drivers\Pgsql\Schema) Open
'string' => $schema->createColumnSchemaBuilder(\yii\db\Schema::TYPE_STRING, 200),
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
'profile' => $db->createCommand('SHOW PROFILE')->queryAll(),
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
'profile' => $db->createCommand('SHOW PROFILE')->queryAll(),
- Exclude checks
Reference to constant TYPE_TIMESTAMP
from undeclared class \yii\db\Schema
(Did you mean class \App\Db\Drivers\Mysql\Schema or class \App\Db\Drivers\Pgsql\Schema) Open
'date' => $schema->createColumnSchemaBuilder(\yii\db\Schema::TYPE_TIMESTAMP)->null(),
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
(new \App\Db\Query())->select(new \yii\db\Expression('sql_no_cache *'))->from('benchmark_temp_table')->where(['id' => $lastId])->all();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand('set profiling=0;')->execute();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
'profile' => $db->createCommand('SHOW PROFILE')->queryAll(),
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
'profile' => $db->createCommand('SHOW PROFILE')->queryAll(),
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
'profile' => $db->createCommand('SHOW PROFILE')->queryAll(),
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand('set profiling=1;')->execute();
- Exclude checks
Reference to constant TYPE_UPK
from undeclared class \yii\db\Schema
(Did you mean class \App\Db\Drivers\Mysql\Schema or class \App\Db\Drivers\Pgsql\Schema) Open
'id' => \yii\db\Schema::TYPE_UPK,
- Exclude checks
Reference to constant TYPE_INTEGER
from undeclared class \yii\db\Schema
(Did you mean class \App\Db\Drivers\Mysql\Schema or class \App\Db\Drivers\Pgsql\Schema) Open
'crmid' => $schema->createColumnSchemaBuilder(\yii\db\Schema::TYPE_INTEGER, 10),
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
(new \App\Db\Query())->select(new \yii\db\Expression('sql_no_cache *'))->from('benchmark_temp_table')->where(['id' => $lastId])->all();
- Exclude checks
Avoid using short method names like Benchmarks::db(). The configured minimum method name length is 3. Open
private static function db(): array
{
$benchmarkCountGroup = 20;
$insertCountGroup = 5;
$updateCountGroup = 5;
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid variables with short names like $t. Configured minimum length is 3. Open
$t = 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
Avoid variables with short names like $t. Configured minimum length is 3. Open
$t = 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
Avoid variables with short names like $j. Configured minimum length is 3. Open
$j = 1;
- 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 $t. Configured minimum length is 3. Open
$t = 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
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = \App\Db::getInstance();
- 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
/**
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
public static $mathFunctions = ['abs', 'acos', 'asin', 'atan', 'floor', 'exp', 'sin', 'tan', 'is_finite', 'is_nan', 'sqrt'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Line exceeds 120 characters; contains 208 characters Open
public static $stringFunctions = ['addslashes', 'chunk_split', 'metaphone', 'strip_tags', 'strtoupper', 'strtolower', 'strrev', 'strlen', 'soundex', 'ord', 'ucfirst', 'ucwords', 'rtrim', 'trim', 'ltrim'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static function cpu(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$hashAlgo = self::$hashAlgo;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($hashAlgo as $algo) {
- 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
$mathCountGroup = 1000;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ((microtime(true) - $timeStart) < $maxTime) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fileContent = file_get_contents($item->getPathname());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mathCountGroup = 5000;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mathMaxTime = 0.3;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$t = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
for ($i = $t; $i < $hashCountGroup; ++$i) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* RAM benchmark.
- 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
}
- 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
private static function hardDrive(): array
- 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
$t = 0;
- 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
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'time' => (int) ($mathOperations / $mathTime),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
for ($j = $t; $j < $mathCountGroup; ++$j) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$t += $mathCountGroup;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fileContent = str_repeat('12345', $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$timeStart = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
for ($i = 0; $i < $countGroup; ++$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
/** @var string[] Math functions 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
private static function ram(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$timeStart = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$readTime += (microtime(true) - $timeStart);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'time' => (int) ($writeOperations / $writeTime),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dirGroup = $dir . $key . \DIRECTORY_SEPARATOR . $t . \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
foreach ([1, 10, 100] as $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* CPU benchmark.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$stringMaxTime = 0.3;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$t += $mathCountGroup;
- 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
'string' => [
- 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
'operations' => $writeOperations,
- 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
for ($i = 0; $i < 4; ++$i) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$t += $mathCountGroup;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$t = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$function("$i - $i | $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
'time' => (int) ($readOperations / $readTime),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$t += $countGroup;
- 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 $stringFunctions = ['addslashes', 'chunk_split', 'metaphone', 'strip_tags', 'strtoupper', 'strtolower', 'strrev', 'strlen', 'soundex', 'ord', 'ucfirst', 'ucwords', 'rtrim', 'trim', 'ltrim'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mathFunctions = self::$mathFunctions;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$stringFunctions = self::$stringFunctions;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$stringOperations = $hashOperations = $mathOperations = 0;
- 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
for ($i = $t; $i < $stringCountGroup; ++$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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
for ($j = 0; $j < $mathCountGroup; ++$j) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'write' => [
- 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
'operations' => $writeOperations,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dirGroup = $dir . $value . \DIRECTORY_SEPARATOR;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string[] Hash functions list */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$mathOperations;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$hashOperations;
- 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
$test[] = [[[$j]]];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$t = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$test[$j];
- 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
$write[$key] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $hashAlgo = ['md4', 'md5', 'crc32', 'sha1', 'adler32', 'ripemd256', 'sha256', 'sha384', 'sha512'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string[] String functions list */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$hashCountGroup = 1000;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ((microtime(true) - $timeStart) < $hashMaxTime) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$stringOperations;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$writeTime = $readTime = $readOperations = $writeOperations = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ((microtime(true) - $timeStart) < 0.05) {
- 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
}
- 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
$hashTime = microtime(true) - $timeStart;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($stringFunctions as $function) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
for ($i = 0; $i < 5; ++$i) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$writeOperations;
- 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
$countGroup = 50;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dir = ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . 'cache' . \DIRECTORY_SEPARATOR . 'speed' . \DIRECTORY_SEPARATOR;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$timeStart = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'time' => (int) ($readOperations / (microtime(true) - $timeStart)),
- 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
$return['benchmark'] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return['insert'] = [
- 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
'string' => $string,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$lastId = $insertOperations;
- 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
* RAM benchmark.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$schema = $db->getSchema();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'date' => $schema->createColumnSchemaBuilder(\yii\db\Schema::TYPE_TIMESTAMP)->null(),
- 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
while ((microtime(true) - $timeStart) < $maxTime) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'date' => date('Y-m-d H:i:s'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'string' => $string,
- 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
'date' => date('Y-m-d H:i:s'),
- 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
return [
- 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
$deleteCountGroup = 5;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$deleteOperations = $selectOperations = $updateOperations = $insertOperations = $benchmarkOperations = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand('SELECT BENCHMARK(1000,1+1);')->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'operations' => $benchmarkOperations,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$insertOperations;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ((microtime(true) - $timeStart) < $maxTime) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$selectOperations;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ((microtime(true) - $timeStart) < $maxTime) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$deleteOperations;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return['delete'] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'operations' => $deleteOperations,
- 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
'read' => $read,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$selectCountGroup = 10;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createTable('benchmark_temp_table', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$timeStart = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
])->execute();
- 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
'operations' => $selectOperations,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'time' => (int) ($updateOperations / (microtime(true) - $timeStart)),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->delete('benchmark_temp_table', ['crmid' => $lastId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->dropTable('benchmark_temp_table')->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'db' => self::db(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\vtlib\Functions::recurseDelete('cache/speed');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$benchmarkCountGroup = 20;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'queryTime' => microtime(true) - $timeStart,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
for ($i = 0; $i < $insertCountGroup; ++$i) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 === $lastId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 === $lastId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'time' => (int) ($deleteOperations / (microtime(true) - $timeStart)),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand = $db->createCommand();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$benchmarkOperations += 1000;
- 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
++$j;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 === $lastId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'time' => (int) ($selectOperations / (microtime(true) - $timeStart)),
- 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
for ($i = 0; $i < $updateCountGroup; ++$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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::error($e->getMessage() . PHP_EOL . $e->__toString());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static function db(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'string' => $schema->createColumnSchemaBuilder(\yii\db\Schema::TYPE_STRING, 200),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return['createTable'] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return['select'] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'write' => $write,
- 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
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'operations' => $updateOperations,
- 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
'profile' => $db->createCommand('SHOW PROFILE')->queryAll(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'crmid' => $schema->createColumnSchemaBuilder(\yii\db\Schema::TYPE_INTEGER, 10),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ((microtime(true) - $timeStart) < $maxTime) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ram' => self::ram(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$hashMaxTime = 0.3;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
for ($i = 0; $i < $selectCountGroup; ++$i) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
(new \App\Db\Query())->select(new \yii\db\Expression('sql_no_cache *'))->from('benchmark_temp_table')->where(['id' => $lastId])->all();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
for ($i = $t; $i < $mathCountGroup; ++$i) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$lastId = $insertOperations;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->update('benchmark_temp_table', [
- 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
'math' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'time' => (int) ($stringOperations / $stringTime),
- 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
$read = $write = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!is_dir($dirGroup)) {
- 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 \DirectoryIterator($itemGroup->getPathname()) as $item) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$updateCountGroup = 5;
- 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
$timeStart = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$lastId = $insertOperations;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return['dropTable'] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'cpu' => self::cpu(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$timeStart = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$function($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
$timeStart = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$insertCountGroup = 5;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'hash' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'id' => \yii\db\Schema::TYPE_UPK,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'time' => (int) ($benchmarkOperations / (microtime(true) - $timeStart)),
- 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
'operations' => $insertOperations,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$writeOperations;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
--$lastId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'profile' => $db->createCommand('SHOW PROFILE')->queryAll(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'time' => (int) ($writeOperations / (microtime(true) - $timeStart)),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
], ['id' => $lastId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$readOperations = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand('set profiling=1;')->execute();
- 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
'profile' => $db->createCommand('SHOW PROFILE')->queryAll(),
- 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
$db->createCommand('set profiling=0;')->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'query' => "SELECT BENCHMARK({$benchmarkOperations},1+1);",
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$j = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'time' => (int) ($insertOperations / (microtime(true) - $timeStart)),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ((microtime(true) - $timeStart) < $maxTime) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$updateOperations;
- 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
--$lastId;
- 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
$maxTime = 0.2;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$timeStart = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->insert('benchmark_temp_table', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$lastId = $insertOperations;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
--$lastId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ((microtime(true) - $timeStart) < $stringMaxTime) {
- 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
foreach ([1 => 207, 10 => 2050, 100 => 20500] as $key => $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
mkdir($dirGroup, 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
} catch (\Throwable $e) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = \App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$db->getTableSchema('benchmark_temp_table')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'profile' => $db->createCommand('SHOW PROFILE')->queryAll(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'crmid' => $j,
- 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
'profile' => $db->createCommand('SHOW PROFILE')->queryAll(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$timeStart = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$lastId = $insertOperations;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $mathFunctions = ['abs', 'acos', 'asin', 'atan', 'floor', 'exp', 'sin', 'tan', 'is_finite', 'is_nan', 'sqrt'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$t = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($mathFunctions as $function) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'operations' => $stringOperations,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$timeStart = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$stringCountGroup = 1000;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'read' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'operations' => $readOperations,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
hash($algo, "$i - $i | $i");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$maxTime = 0.2;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$t += $mathCountGroup;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
file_put_contents("{$dirGroup}{$i}.txt", $fileContent);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'operations' => $hashOperations,
- 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
'time' => (int) ($hashOperations / $hashTime),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
register_shutdown_function(function () {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- 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
return [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'profile' => $db->createCommand('SHOW PROFILE')->queryAll(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
(new \App\Db\Query())->select(new \yii\db\Expression('sql_no_cache *'))->from('benchmark_temp_table')->where(['id' => $lastId])->all();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$lastId = $insertOperations;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (new \DirectoryIterator($dirGroup) as $itemGroup) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($item->isFile()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'operations' => $readOperations,
- 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
try {
- 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
$string = str_repeat('zxcvb', 20);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
for ($i = 0; $i < $benchmarkCountGroup; ++$i) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function all()
- 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
'hardDrive' => self::hardDrive(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ((microtime(true) - $timeStart) < $mathMaxTime) {
- 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
$mathTime = microtime(true) - $timeStart;
- 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
$timeStart = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$stringTime = microtime(true) - $timeStart;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'operations' => $mathOperations,
- 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
$writeTime += (microtime(true) - $timeStart);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ((microtime(true) - $timeStart) < 0.05) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$readOperations;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Hard drive benchmark.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$writeOperations = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$itemGroup->isDot() && $itemGroup->isDir()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$readOperations;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$read[$value] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw $e;
- 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
$timeStart = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$string = str_repeat('123', 20);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return['update'] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'profile' => $db->createCommand('SHOW PROFILE')->queryAll(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
for ($i = 0; $i < $deleteCountGroup; ++$i) {
- Exclude checks