1 | <?php |
||
8 | class PdoAllSalesmen implements ContainerInterface, \IteratorAggregate, \Countable |
||
9 | { |
||
10 | /** |
||
11 | * @var \PDO |
||
12 | */ |
||
13 | public $pdo; |
||
14 | |||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | public $table = "salesmen"; |
||
19 | |||
20 | /** |
||
21 | * Holds all retrieved SalesmenInterface instances |
||
22 | * @var SalesmanInterface[] |
||
23 | */ |
||
24 | public $salesmen = array(); |
||
25 | |||
26 | /** |
||
27 | * @param \PDO $pdo PDO handler |
||
28 | * @param string $table The table name to use |
||
29 | * @param SalesmanInterface|null $salesman Class or object template to work with |
||
30 | */ |
||
31 | public function __construct (\PDO $pdo, $table, SalesmanInterface $salesman = null) |
||
67 | |||
68 | |||
69 | /** |
||
70 | * @implements ContainerInterface |
||
71 | */ |
||
72 | public function has ($aussendienst_nummer) { |
||
78 | |||
79 | |||
80 | /** |
||
81 | * @implements ContainerInterface |
||
82 | */ |
||
83 | public function get ($aussendienst_nummer) { |
||
95 | |||
96 | |||
97 | /** |
||
98 | * @return Iterator |
||
99 | */ |
||
100 | public function getIterator() |
||
104 | |||
105 | |||
106 | /** |
||
107 | * @return int |
||
108 | */ |
||
109 | public function count() |
||
113 | } |
||
114 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: