1 | <?php |
||
43 | class Builder extends ObjectAbstract implements BuilderInterface |
||
44 | { |
||
45 | use DialectAwareTrait, SettingsTrait, ParameterAwareTrait; |
||
46 | |||
47 | /** |
||
48 | * tables |
||
49 | * |
||
50 | * @var array |
||
51 | * @access protected |
||
52 | */ |
||
53 | protected $tables = []; |
||
54 | |||
55 | /** |
||
56 | * Constructor |
||
57 | * |
||
58 | * ```php |
||
59 | * // builder with default table `users` and Mysql dialect |
||
60 | * $users = new Builder('users', new Mysql()) |
||
61 | * |
||
62 | * // builder with defult tables: `users` and `accounts` AS `a` |
||
63 | * $builder = new Builder(['users', 'accounts' => 'a']) |
||
64 | * |
||
65 | * // change default settings |
||
66 | * $builder = new Builder('users', new Mysql(), ['autoQuote' => false]); |
||
67 | * ``` |
||
68 | * |
||
69 | * @param string|array $table table[s] to build upon |
||
70 | * @param DialectInterface $dialect default dialect is `Mysql` |
||
71 | * @param array $settings builder settings |
||
72 | * @access public |
||
73 | */ |
||
74 | public function __construct( |
||
75 | $table = '', |
||
76 | DialectInterface $dialect = null, |
||
77 | array $settings = [] |
||
78 | ) { |
||
79 | $this |
||
80 | ->initParameter() |
||
81 | ->setSettings(array_replace($this->defaultSettings(), $settings)) |
||
82 | ->setDialect($dialect) |
||
83 | ->table($table); |
||
84 | } |
||
85 | |||
86 | /** |
||
87 | * Change table[s] |
||
88 | * |
||
89 | * @param $table change to table[s] |
||
90 | * @return $this |
||
91 | * @access public |
||
92 | */ |
||
93 | public function __invoke($table) |
||
94 | { |
||
95 | return $this->table($table); |
||
96 | } |
||
97 | |||
98 | /** |
||
99 | * {@inheritDoc} |
||
100 | */ |
||
101 | public function expr()/*# : ExpressionInterface */ |
||
102 | { |
||
103 | return new Expression($this); |
||
104 | } |
||
105 | |||
106 | /** |
||
107 | * {@inheritDoc} |
||
108 | */ |
||
109 | public function raw(/*# string */ $string)/*# : OutputInterface */ |
||
110 | { |
||
111 | // values found |
||
112 | if (func_num_args() > 1) { |
||
113 | $values = func_get_arg(1); |
||
114 | $string = $this->getParameter() |
||
115 | ->replaceQuestionMark($string, $values); |
||
116 | } |
||
117 | return new Raw($string); |
||
118 | } |
||
119 | |||
120 | /** |
||
121 | * If has existing tables, return a new instance with provided table[s] |
||
122 | * |
||
123 | * {@inheritDoc} |
||
124 | */ |
||
125 | public function table($table, /*# string */ $alias = '') |
||
132 | |||
133 | /** |
||
134 | * Append to existing tables |
||
135 | * |
||
136 | * {@inheritDoc} |
||
137 | */ |
||
138 | public function from($table, /*# string */ $alias = '') |
||
144 | |||
145 | /** |
||
146 | * {@inheritDoc} |
||
147 | */ |
||
148 | public function select( |
||
156 | |||
157 | /** |
||
158 | * {@inheritDoc} |
||
159 | */ |
||
160 | public function insert(array $values = [])/*# : InsertStatementInterface */ |
||
166 | |||
167 | /** |
||
168 | * Convert to [$table => alias] or [$table] |
||
169 | * |
||
170 | * @param string|string[] $table |
||
171 | * @param string $alias |
||
172 | * @return array |
||
173 | * @access protected |
||
174 | */ |
||
175 | protected function fixTable( |
||
186 | |||
187 | /** |
||
188 | * Builder default settings |
||
189 | * |
||
190 | * @return array |
||
191 | * @access protected |
||
192 | */ |
||
193 | protected function defaultSettings()/*# : array */ |
||
205 | } |
||
206 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.