Conditions | 4 |
Paths | 1 |
Total Lines | 20 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
42 | protected function generateCrawler() |
||
43 | { |
||
44 | if (!Helper::validateCif($this->getCif())) { |
||
45 | throw new InvalidCifException(); |
||
46 | } |
||
47 | $year = intval($this->getYear()); |
||
48 | if ($year < 2000 or $year > date('Y')) { |
||
|
|||
49 | throw new InvalidArgumentException( |
||
50 | 'Year [' . $this->getYear() . '] is invalid' |
||
51 | ); |
||
52 | } |
||
53 | $crawler = $this->getClient()->request( |
||
54 | 'GET', |
||
55 | 'http://www.mfinante.gov.ro/infocodfiscal.html?' . |
||
56 | 'an=WEB_ONG_AN' . $year |
||
57 | . '&cod=' . $this->getCif() |
||
58 | . '&captcha=null' |
||
59 | . '&method.bilant=VIZUALIZARE' |
||
60 | ); |
||
61 | 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
die
introduces 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 withthrow
at this point:These limitations lead to logical operators rarely being of use in current PHP code.