Completed
Pull Request — 2.x (#108)
by Sullivan
03:43 queued 01:25
created

IsoCodesGeneric   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 10
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A validatedBy() 0 4 1
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 14 and the first side effect is on line 7.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
namespace SLLH\IsoCodesValidator\Constraints;
4
5
use Symfony\Component\Validator\Constraint;
6
7
@trigger_error('The '.__NAMESPACE__.'\IsoCodesGeneric class is deprecated since version 2.1 and will be removed in 3.0.', E_USER_DEPRECATED);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 141 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
8
9
/**
10
 * @author Sullivan Senechal <[email protected]>
11
 *
12
 * @deprecated since version 2.1. To be removed in 3.0
13
 */
14
class IsoCodesGeneric extends Constraint
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function validatedBy()
20
    {
21
        return __CLASS__.'Validator';
22
    }
23
}
24