| Conditions | 4 |
| Paths | 1 |
| Total Lines | 20 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4.1574 |
| Changes | 0 | ||
| 1 | <?php |
||
| 42 | 1 | protected function generateCrawler() |
|
| 43 | { |
||
| 44 | 1 | if (!Helper::validateCif($this->getCif())) { |
|
| 45 | throw new InvalidCifException(); |
||
| 46 | } |
||
| 47 | 1 | $year = intval($this->getYear()); |
|
| 48 | 1 | if ($year < 2000 or $year > date('Y')) { |
|
|
|
|||
| 49 | throw new InvalidArgumentException( |
||
| 50 | 'Year [' . $this->getYear() . '] is invalid' |
||
| 51 | ); |
||
| 52 | } |
||
| 53 | 1 | $crawler = $this->getClient()->request( |
|
| 54 | 1 | 'GET', |
|
| 55 | 'http://www.mfinante.gov.ro/infocodfiscal.html?' . |
||
| 56 | 1 | 'an=WEB_ONG_AN' . $year |
|
| 57 | 1 | . '&cod=' . $this->getCif() |
|
| 58 | 1 | . '&captcha=null' |
|
| 59 | 1 | . '&method.bilant=VIZUALIZARE' |
|
| 60 | ); |
||
| 61 | 1 | return $crawler; |
|
| 62 | } |
||
| 96 |
PHP has two types of connecting operators (logical operators, and boolean operators):
and&&or||The difference between these is the order in which they are executed. In most cases, you would want to use a boolean operator like
&&, or||.Let’s take a look at a few examples:
Logical Operators are used for Control-Flow
One case where you explicitly want to use logical operators is for control-flow such as this:
Since
dieintroduces problems of its own, f.e. it makes our code hardly testable, and prevents any kind of more sophisticated error handling; you probably do not want to use this in real-world code. Unfortunately, logical operators cannot be combined withthrowat this point:These limitations lead to logical operators rarely being of use in current PHP code.