1 | <?php |
||
21 | final class JsynExtractor |
||
22 | { |
||
23 | /** |
||
24 | * @var string |
||
25 | * |
||
26 | * Content of the JSYN File |
||
27 | */ |
||
28 | private $jsyn; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | * |
||
33 | * SQL Syntax to use for script generation |
||
34 | */ |
||
35 | private $sqlSyntax; |
||
36 | |||
37 | /** |
||
38 | * @param string $jsynFile string | PathUtil |
||
39 | * @param $sqlSyntax string |
||
40 | */ |
||
41 | public function __construct($jsynFile, $sqlSyntax) |
||
46 | |||
47 | /** |
||
48 | * @param $jsynFile string | PathUtil |
||
49 | * |
||
50 | * Setter function for the jsonFile global property |
||
51 | * |
||
52 | * @return void |
||
53 | */ |
||
54 | public function setJsynFile($jsynFile) |
||
66 | |||
67 | /** |
||
68 | * @param $sqlSyntax string |
||
69 | * |
||
70 | * Setter function for the sqlSyntax global property |
||
71 | * |
||
72 | * @return void |
||
73 | */ |
||
74 | public function setSqlSyntax($sqlSyntax) |
||
85 | |||
86 | /** |
||
87 | * @return string |
||
88 | */ |
||
89 | public function getJsyn() |
||
93 | |||
94 | /** |
||
95 | * Performs extraction of the appropriate sql syntax |
||
96 | * fromthe supplied jsyn file. |
||
97 | * |
||
98 | * @return void |
||
99 | */ |
||
100 | public function formatJsyn() |
||
110 | |||
111 | /** |
||
112 | * Returns the extracted jsyn as a string. |
||
113 | * |
||
114 | * @return string |
||
115 | */ |
||
116 | public function __toString() |
||
120 | } |
||
121 |
If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration: