1 | <?php |
||
20 | class JsonServer |
||
21 | { |
||
22 | /** |
||
23 | * Server key. |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $serverKey = ''; |
||
28 | |||
29 | /** |
||
30 | * Server class. |
||
31 | * |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $serverClass = ''; |
||
35 | |||
36 | /** |
||
37 | * Check if the SMD should rendered. |
||
38 | * |
||
39 | * @var bool |
||
40 | */ |
||
41 | protected $renderSmd = false; |
||
42 | |||
43 | /** |
||
44 | * Build up the object. |
||
45 | * |
||
46 | * @param string $server |
||
47 | * @param bool $smd |
||
48 | */ |
||
49 | public function __construct($server, $smd) |
||
58 | |||
59 | /** |
||
60 | * Handle the request. |
||
61 | * |
||
62 | * @param $request |
||
63 | * |
||
64 | * @throws \Exception |
||
65 | */ |
||
66 | public function handle($request) |
||
89 | |||
90 | /** |
||
91 | * Handle the service request. |
||
92 | * |
||
93 | * @param $request |
||
94 | */ |
||
95 | protected function handleRequest($request) |
||
108 | |||
109 | /** |
||
110 | * Handle the SMD request. |
||
111 | */ |
||
112 | protected function renderSmd() |
||
123 | |||
124 | /** |
||
125 | * Get the Service URI. |
||
126 | * |
||
127 | * @return string |
||
128 | */ |
||
129 | protected function getServiceUri() |
||
137 | } |
||
138 |
This check looks for type mismatches where the missing type is
false
. This is usually indicative of an error condtion.Consider the follow example
This function either returns a new
DateTime
object or false, if there was an error. This is a typical pattern in PHP programming to show that an error has occurred without raising an exception. The calling code should check for this returnedfalse
before passing on the value to another function or method that may not be able to handle afalse
.