| Conditions | 1 |
| Paths | 1 |
| Total Lines | 33 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | public function createPageRule() |
||
| 36 | { |
||
| 37 | $endpoint = new \Cloudflare\API\Endpoints\PageRules($this->_connection); |
||
| 38 | // Define your targets |
||
| 39 | // Currently you can only specify one URL per page rule but this implementation matches the API |
||
| 40 | // so I am leaving it for now in the assumption they are planning to add multiple targets. |
||
| 41 | // PageRulesTargets |
||
| 42 | $target = [ |
||
| 43 | [ |
||
| 44 | 'target' => 'url', |
||
| 45 | 'constraint' => |
||
| 46 | [ |
||
| 47 | 'operator' => 'matches', |
||
| 48 | 'value' => 'http://example.co.uk/*' |
||
| 49 | ] |
||
| 50 | ] |
||
| 51 | ]; |
||
| 52 | |||
| 53 | // Define your actions |
||
| 54 | // Each action is held within it's own array. |
||
| 55 | // PageRulesActions |
||
| 56 | $actions = [ |
||
| 57 | [ |
||
| 58 | 'id' => 'always_online', |
||
| 59 | 'value' => 'on' |
||
| 60 | ] |
||
| 61 | ]; |
||
| 62 | |||
| 63 | $active = true; |
||
| 64 | $priority = null; //int |
||
| 65 | |||
| 66 | $endpoint->createPageRule($zoneID, $targets, $actions, $active, $priority); |
||
| 67 | } |
||
| 68 | } |
||
| 69 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.