Function findByDomainField
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
public static function findByDomainField(string $moduleName, array $fields, array $emails): array
{
$return = $activeFields = $domainsAndEmails = [];
foreach ($emails as $email) {
$domainsAndEmails[mb_strtolower(explode('@', $email)[1])][] = $email;
- 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 class RecordFinder has an overall complexity of 51 which is very high. The configured complexity threshold is 50. Open
class RecordFinder
{
/**
* Emails cache.
*
- Exclude checks
Function findByEmailField
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public static function findByEmailField(string $moduleName, array $fields, array $emails): array
{
$activeFields = $conditions = $return = [];
foreach ($emails as $i => $email) {
if (isset(self::$emailsCache[$moduleName][$email])) {
- 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 findByDomainField
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function findByDomainField(string $moduleName, array $fields, array $emails): array
{
$return = $activeFields = $domainsAndEmails = [];
foreach ($emails as $email) {
$domainsAndEmails[mb_strtolower(explode('@', $email)[1])][] = $email;
Method findByEmailField
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function findByEmailField(string $moduleName, array $fields, array $emails): array
{
$activeFields = $conditions = $return = [];
foreach ($emails as $i => $email) {
if (isset(self::$emailsCache[$moduleName][$email])) {
Function findByRecordNumber
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function findByRecordNumber(array $numbers, string $moduleName, array $fields): array
{
$return = [];
foreach ($numbers as $i => $number) {
if (isset(self::$recordNumberCache[$moduleName][$number])) {
- 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 getRecordNumberFromString
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getRecordNumberFromString(string $value, string $moduleName, bool $multi = false)
{
$moduleData = \App\Fields\RecordNumber::getInstance($moduleName);
$prefix = str_replace(['\{\{YYYY\}\}', '\{\{YY\}\}', '\{\{MM\}\}', '\{\{DD\}\}', '\{\{M\}\}', '\{\{D\}\}'], ['\d{4}', '\d{2}', '\d{2}', '\d{2}', '\d{1,2}', '\d{1,2}'], preg_quote($moduleData->get('prefix'), '/'));
$postfix = str_replace(['\{\{YYYY\}\}', '\{\{YY\}\}', '\{\{MM\}\}', '\{\{DD\}\}', '\{\{M\}\}', '\{\{D\}\}'], ['\d{4}', '\d{2}', '\d{2}', '\d{2}', '\d{1,2}', '\d{1,2}'], preg_quote($moduleData->get('postfix'), '/'));
Function getRecordNumberFromString
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function getRecordNumberFromString(string $value, string $moduleName, bool $multi = false)
{
$moduleData = \App\Fields\RecordNumber::getInstance($moduleName);
$prefix = str_replace(['\{\{YYYY\}\}', '\{\{YY\}\}', '\{\{MM\}\}', '\{\{DD\}\}', '\{\{M\}\}', '\{\{D\}\}'], ['\d{4}', '\d{2}', '\d{2}', '\d{2}', '\d{1,2}', '\d{1,2}'], preg_quote($moduleData->get('prefix'), '/'));
$postfix = str_replace(['\{\{YYYY\}\}', '\{\{YY\}\}', '\{\{MM\}\}', '\{\{DD\}\}', '\{\{M\}\}', '\{\{D\}\}'], ['\d{4}', '\d{2}', '\d{2}', '\d{2}', '\d{1,2}', '\d{1,2}'], preg_quote($moduleData->get('postfix'), '/'));
- 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 findByEmail
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function findByEmail($emails, array $modulesFields): array
{
if (empty($emails)) {
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
Avoid too many return
statements within this method. Open
return false;
The method findByDomainField() has an NPath complexity of 200. The configured NPath complexity threshold is 200. Open
public static function findByDomainField(string $moduleName, array $fields, array $emails): array
{
$return = $activeFields = $domainsAndEmails = [];
foreach ($emails as $email) {
$domainsAndEmails[mb_strtolower(explode('@', $email)[1])][] = $email;
- 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 findByDomainField() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10. Open
public static function findByDomainField(string $moduleName, array $fields, array $emails): array
{
$return = $activeFields = $domainsAndEmails = [];
foreach ($emails as $email) {
$domainsAndEmails[mb_strtolower(explode('@', $email)[1])][] = $email;
- 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 findByEmailField() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. Open
public static function findByEmailField(string $moduleName, array $fields, array $emails): array
{
$activeFields = $conditions = $return = [];
foreach ($emails as $i => $email) {
if (isset(self::$emailsCache[$moduleName][$email])) {
- 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 19 to the 15 allowed. Open
public static function findByEmailField(string $moduleName, array $fields, array $emails): 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 41 to the 15 allowed. Open
public static function findByDomainField(string $moduleName, array $fields, array $emails): 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
The method getRecordNumberFromString has a boolean flag argument $multi, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getRecordNumberFromString(string $value, string $moduleName, bool $multi = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '248', column '26'). Open
$queryGenerator = new \App\QueryGenerator($moduleName);
- 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 '85', column '25'). Open
$queryGenerator = new \App\QueryGenerator($moduleName);
- 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 '133', column '25'). Open
$queryGenerator = new \App\QueryGenerator($moduleName);
- 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
The method findByEmail uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$ids = array_replace_recursive($ids, static::findByEmailField($module, $fields, $emails));
}
- 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 assigning values to variables in if clauses and the like (line '88', column '8'). Open
public static function findByEmailField(string $moduleName, array $fields, array $emails): array
{
$activeFields = $conditions = $return = [];
foreach ($emails as $i => $email) {
if (isset(self::$emailsCache[$moduleName][$email])) {
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class '\App\Fields\Picklist' in method 'getRecordNumberFromString'. Open
$picklistPrefix = array_column(\App\Fields\Picklist::getValues($matches[1]), 'prefix');
- 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\Utils' in method 'findBySubject'. Open
$records = array_merge($records, \App\Utils::flatten(self::findByRecordNumber($numbers, $moduleName, \App\Utils::flatten($fields))));
- 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\Utils' in method 'findBySubject'. Open
$records = array_merge($records, \App\Utils::flatten(self::findByRecordNumber($numbers, $moduleName, \App\Utils::flatten($fields))));
- 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 getRecordNumberFromString uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
preg_match($redex, $value, $match);
if (!empty($match)) {
return trim($match[0], '[,]');
}
- 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 '\App\Fields\RecordNumber' in method 'getRecordNumberFromString'. Open
$moduleData = \App\Fields\RecordNumber::getInstance($moduleName);
- 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 '\Users_Module_Model' in method 'findUserEmail'. Open
if (!\Users_Module_Model::checkMailExist($email)) {
- 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 assigning values to variables in if clauses and the like (line '150', column '10'). Open
public static function findByDomainField(string $moduleName, array $fields, array $emails): array
{
$return = $activeFields = $domainsAndEmails = [];
foreach ($emails as $email) {
$domainsAndEmails[mb_strtolower(explode('@', $email)[1])][] = $email;
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Define a constant instead of duplicating this literal "\d{1,2}" 4 times. Open
$prefix = str_replace(['\{\{YYYY\}\}', '\{\{YY\}\}', '\{\{MM\}\}', '\{\{DD\}\}', '\{\{M\}\}', '\{\{D\}\}'], ['\d{4}', '\d{2}', '\d{2}', '\d{2}', '\d{1,2}', '\d{1,2}'], preg_quote($moduleData->get('prefix'), '/'));
- 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 "\d{2}" 6 times. Open
$prefix = str_replace(['\{\{YYYY\}\}', '\{\{YY\}\}', '\{\{MM\}\}', '\{\{DD\}\}', '\{\{M\}\}', '\{\{D\}\}'], ['\d{4}', '\d{2}', '\d{2}', '\d{2}', '\d{1,2}', '\d{1,2}'], preg_quote($moduleData->get('prefix'), '/'));
- 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.
Call to method setOrder
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->setOrder('id', 'DESC');
- Exclude checks
Call to method __construct
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator = new \App\QueryGenerator($moduleName);
- Exclude checks
Call to method addCondition
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->addCondition($field, $domain, 'a', false);
- Exclude checks
Call to method addCondition
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->addCondition($fieldName, $numbers, 'e', false);
- Exclude checks
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
if ($queryGenerator->getModuleField($field)) {
- Exclude checks
Call to method setFields
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->setFields(array_merge(['id'], $activeFields));
- Exclude checks
Call to method __construct
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator = new \App\QueryGenerator($moduleName);
- Exclude checks
Call to method setFields
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->setFields(array_merge(['id'], $activeFields));
- Exclude checks
Call to method createQuery
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$dataReader = $queryGenerator->createQuery()->createCommand()->query();
- Exclude checks
Reference to instance property permissions
from undeclared class \App\QueryGenerator
Open
$queryGenerator->permissions = false;
- Exclude checks
Call to method createQuery
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$dataReader = $queryGenerator->createQuery()->createCommand()->query();
- Exclude checks
Call to method getInstance
from undeclared class \App\Fields\RecordNumber
(Did you mean class \Tests\Base\RecordNumber) Open
$moduleData = \App\Fields\RecordNumber::getInstance($moduleName);
- Exclude checks
Reference to instance property permissions
from undeclared class \App\QueryGenerator
Open
$queryGenerator->permissions = false;
- Exclude checks
Reference to instance property permissions
from undeclared class \App\QueryGenerator
Open
$queryGenerator->permissions = false;
- Exclude checks
Call to method __construct
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator = new \App\QueryGenerator($moduleName);
- Exclude checks
Call to method createQuery
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$query = $queryGenerator->createQuery();
- Exclude checks
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
if ($fieldsModel = $queryGenerator->getModuleField($field)) {
- Exclude checks
Call to method setFields
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->setFields(array_merge(['id'], $fields));
- 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
* Record number cache.
- 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 findByEmail($emails, array $modulesFields): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\is_array($emails)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ids = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ids = array_replace_recursive($ids, static::findByDomainField($module, $fields, $emails));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->setFields(array_merge(['id'], $activeFields));
- 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
* @param string[] $fields
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($emails as $email) {
- 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
$queryGenerator->setFields(array_merge(['id'], $activeFields));
- 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
* Emails cache.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Domain cache.
- 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
* Search crm ids by emails field and module name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->permissions = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fields as $field) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$activeFields[] = $field;
- 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 (!$activeFields) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($activeFields as $field) {
- 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
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($queryGenerator->getModuleField($field)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$activeFields[] = $field;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$domainCache[$moduleName][$email] = $return[$email] = [];
- 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 ($modulesFields as $module => $fieldsByType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ids = array_replace_recursive($ids, static::findByEmailField($module, $fields, $emails));
- 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
unset($emails[$i]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = $queryGenerator->createQuery();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string[] $emails
- 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 ($fields as $field) {
- 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 $recordNumberCache = [];
- 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
* @param string $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$domains = array_keys($domainsAndEmails);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->addCondition($field, $domain, 'a', false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $queryGenerator->createQuery()->createCommand()->query();
- 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
* @param string $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string[] $fields
- 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
if (isset(self::$emailsCache[$moduleName][$email])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere(array_merge(['or'], $conditions));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $query->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$emailsCache[$moduleName][$rowEmail][] = $return[$rowEmail][] = $row['id'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($emails as $i => $email) {
- 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
$rowDomains = $row[$field];
- 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
public static function findByEmailField(string $moduleName, array $fields, array $emails): 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
public static function findByDomainField(string $moduleName, array $fields, array $emails): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$domainsAndEmails[mb_strtolower(explode('@', $email)[1])][] = $email;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($emails[array_search($email, $emails)]);
- 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($domainsAndEmails[$intersectRow])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Find email address.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $ids;
- 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
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->permissions = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- 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
$emails = explode(',', $emails);
- 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
* @param string[] $emails
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (319 === $uiType) {
- 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
unset($emails[array_search($rowEmail, $emails)]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($domainsAndEmails[$intersectRow] as $email) {
- 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 ($activeFields as $field) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rowDomains = $rowDomains ? explode(',', trim($rowDomains, ',')) : [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($intersectRows = array_intersect($domains, $rowDomains)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$domainCache[$moduleName][$email][] = $return[$email][] = $row['id'];
- 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
* Gets the prefix from text.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $multi
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return '((' . implode('|', $picklistPrefix) . ')*)';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function findByRecordNumber(array $numbers, string $moduleName, array $fields): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->setFields(array_merge(['id'], $fields));
- 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
$queryGenerator->setOrder('id', 'DESC');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $emailsCache = [];
- 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
$activeFields = $conditions = $return = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return[$email] = self::$emailsCache[$moduleName][$email];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$conditions[] = [$fieldsModel->getColumnName() => $emails];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($emails) {
- 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
foreach ($intersectRows as $intersectRow) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($emails as $email) {
- 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 $domainCache = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $modulesFields
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator = new \App\QueryGenerator($moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rowEmail = $row[$field];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($rowEmail, $emails)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($domains as $domain) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($activeFields) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Find email address.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$picklistPrefix) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($match[0])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->permissions = false;
- 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
* @param mixed $emails
- 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
foreach ($fieldsByType as $uiType => $fields) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($fieldsModel = $queryGenerator->getModuleField($field)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$emailsCache[$moduleName][$email] = $return[$email] = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Search crm ids by domains field and module name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $subject
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$numbers || !$fields) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool|string|array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$redex = preg_replace_callback('/\\\\{\\\\{picklist\\\\:([a-z0-9_]+)\\\\}\\\\}/i', function ($matches) {
- 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
* @param array $numbers
- 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
* @var array
- 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
if (empty($emails)) {
- 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
$records = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$numbers = self::getRecordNumberFromString($subject, $moduleName, true);
- 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
preg_match($redex, $value, $match);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($numbers) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator = new \App\QueryGenerator($moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fields as $fieldName) {
- 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
return $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
*
- 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
preg_match_all($redex, $value, $match);
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->addCondition($fieldName, $numbers, 'e', false);
- 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 (!\Users_Module_Model::checkMailExist($email)) {
- 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
* @var 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($emails as $i => $email) {
- 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 = $activeFields = $domainsAndEmails = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator = new \App\QueryGenerator($moduleName);
- 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 ($multi) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return[] = trim($row, '[,]');
- 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
* @param array $fields
- 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
* @param array $modulesFields
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $value
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$postfix = str_replace(['\{\{YYYY\}\}', '\{\{YY\}\}', '\{\{MM\}\}', '\{\{DD\}\}', '\{\{M\}\}', '\{\{D\}\}'], ['\d{4}', '\d{2}', '\d{2}', '\d{2}', '\d{1,2}', '\d{1,2}'], preg_quote($moduleData->get('postfix'), '/'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- 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
* @param string $moduleName
- 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
$picklistPrefix = array_column(\App\Fields\Picklist::getValues($matches[1]), 'prefix');
- 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 function findUserEmail(array $emails): 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($match[0] as $row) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($match)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($numbers as $i => $number) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fields as $fieldName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($emails as $key => $email) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($emails[$key]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function findBySubject($subject, array $modulesFields): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($modulesFields as $moduleName => $fields) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Line exceeds 120 characters; contains 221 characters Open
$prefix = str_replace(['\{\{YYYY\}\}', '\{\{YY\}\}', '\{\{MM\}\}', '\{\{DD\}\}', '\{\{M\}\}', '\{\{D\}\}'], ['\d{4}', '\d{2}', '\d{2}', '\d{2}', '\d{1,2}', '\d{1,2}'], preg_quote($moduleData->get('prefix'), '/'));
- Exclude checks
Line exceeds 120 characters; contains 223 characters Open
$postfix = str_replace(['\{\{YYYY\}\}', '\{\{YY\}\}', '\{\{MM\}\}', '\{\{DD\}\}', '\{\{M\}\}', '\{\{D\}\}'], ['\d{4}', '\d{2}', '\d{2}', '\d{2}', '\d{1,2}', '\d{1,2}'], preg_quote($moduleData->get('postfix'), '/'));
- 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
if (isset(self::$recordNumberCache[$moduleName][$number])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $queryGenerator->createQuery()->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$recordNumberCache[$moduleName][$number] = $return[$number][] = $row['id'];
- 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
}
- 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
$number = $row[$fieldName];
- 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
$records = array_merge($records, \App\Utils::flatten(self::findByRecordNumber($numbers, $moduleName, \App\Utils::flatten($fields))));
- Exclude checks
Line exceeds 120 characters; contains 145 characters Open
$records = array_merge($records, \App\Utils::flatten(self::findByRecordNumber($numbers, $moduleName, \App\Utils::flatten($fields))));
- 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 $records;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getRecordNumberFromString(string $value, string $moduleName, bool $multi = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleData = \App\Fields\RecordNumber::getInstance($moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return trim($match[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
* Find record by sequence number field.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Find user email.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return 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
* @param array $emails
- 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
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName
- 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
unset($numbers[$i]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $emails;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$prefix = str_replace(['\{\{YYYY\}\}', '\{\{YY\}\}', '\{\{MM\}\}', '\{\{DD\}\}', '\{\{M\}\}', '\{\{D\}\}'], ['\d{4}', '\d{2}', '\d{2}', '\d{2}', '\d{1,2}', '\d{1,2}'], preg_quote($moduleData->get('prefix'), '/'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}, '/\[' . $prefix . '([0-9]*)' . $postfix . '\]/');
- 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
$return[$number] = self::$recordNumberCache[$moduleName][$number];
- 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