Component   D
last analyzed

Complexity

Total Complexity 109

Size/Duplication

Total Lines 382
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 109
c 1
b 0
f 0
lcom 2
cbo 4
dl 0
loc 382
ccs 295
cts 295
cp 1
rs 4.8717

19 Methods

Rating   Name   Duplication   Size   Complexity  
D __construct() 0 33 9
A __get() 0 6 2
B create() 0 25 5
C settings() 0 28 8
A orderIn() 0 14 3
D recreate() 0 47 15
C alter() 0 37 14
C index() 0 29 11
C info() 0 46 16
A dbPrepare() 0 8 2
A dbPrepareError() 0 4 2
A dbExecuteError() 0 4 1
A dbStyle() 0 14 3
A dbFetch() 0 4 2
A dbInserted() 0 4 1
A dbAffected() 0 4 1
A dbEscape() 0 4 2
D dbExecute() 0 36 10
A dbClose() 0 9 2

How to fix   Complexity   

Complex Class

Complex classes like Component often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use Component, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
namespace BootPress\SQLite;
4
5
use BootPress\Database\Component as Database;
6
7
class Component extends Database
8
{
9
    public $fts;
10
    public $created = false; // whether or not this is a new database
11
    private $info = array();
12
13 49
    public function __construct($file = null)
14
    {
15 49
        if (is_null($file)) {
16 2
            $file = ':memory:';
17 2
            $this->created = true;
18 2
        } else {
19 48
            if (!is_file($file)) {
20 8
                if (!is_dir(dirname($file))) {
21 2
                    mkdir(dirname($file), 0755, true);
22 2
                }
23 8
                $this->created = true;
24 8
            }
25 48
            if (class_exists('BootPress\Page\Component') && class_exists('Symfony\Component\Yaml\Yaml')) {
26 48
                $page = \BootPress\Page\Component::html();
27 48
                $databases = $page->file('databases.yml');
28 48
                $yaml = (is_file($databases)) ? \Symfony\Component\Yaml\Yaml::parse(file_get_contents($databases)) : array();
29 48
                if (!isset($yaml['sqlite'])) {
30 1
                    $yaml['sqlite'] = array();
31 1
                }
32 48
                if (!in_array($file, $yaml['sqlite'])) {
33 7
                    $yaml['sqlite'][] = $file;
34 7
                    ksort($yaml);
35 7
                    sort($yaml['sqlite']);
36 7
                    $yaml = \Symfony\Component\Yaml\Yaml::dump($yaml, 3);
37 7
                    file_put_contents($databases, $yaml);
38 7
                }
39 48
            }
40
        }
41 49
        $this->driver($file);
42 49
        $this->connection = new \SQLite3($file);
43 49
        $this->connection->exec('PRAGMA foreign_keys = ON');
44 49
        $this->fts = new Fts($this);
45 49
    }
46
    
47 1
    public function __get($name)
48
    {
49 1
        if ($name == 'connection') {
50 1
            return $this->connection; // not normally needed, but this allows you to close the database
51
        }
52 1
    }
53
54 8
    public function create($table, array $fields, $index = array(), array $changes = array())
55
    {
56 8
        $columns = array();
57 8
        foreach ($fields as $name => $type) {
58 8
            $columns[] = (is_int($name)) ? $type : $name.' '.$type;
59 8
        }
60 8
        $columns = implode(", \n\t", $columns);
61 8
        $query = 'CREATE TABLE '.$table.' ('.$columns.')';
62 8
        $executed = $this->info('tables', $table);
63
        // See http://www.sqlite.org/fileformat2.html - 2.5 Storage Of The SQL Database Schema
64 8
        if (preg_replace('/(\'|")/', '', $query) == preg_replace('/(\'|")/', '', $executed)) {
65 1
            $this->index($table, $index); // make sure they are all correct also
66 1
            return false; // the table has already been created in it's requested state
67
        }
68 8
        $this->info('tables', $table, $query); // to either add or update
69 8
        if ($executed) { // then this table is being altered in some way
70 1
            $this->index($table, '');
71 1
            $this->alter($table, $fields, $changes, $columns);
72 1
        } else {
73 8
            $this->exec($query); // We should only get here once
74
        }
75 8
        $this->index($table, $index);
76
77 8
        return true; // the table has been created (or altered)
78
    }
79
80 1
    public function settings()
81
    {
82 1
        switch (func_num_args()) {
83 1
            case 0: // they want it all
84 1
                return $this->info('settings');
85
                break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
86 1
            case 1: // they want to retrieve a specific setting
87 1
                return $this->info('settings', func_get_arg(0));
88
                break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
89 1
            case 2: // they want to establish a setting
90 1
                $update = false;
91 1
                list($setting, $value) = func_get_args();
92 1
                $current = $this->info('settings', $setting);
93 1
                if ($value === false) { // then we don't want this in the database as "false" is the default value
94 1
                    if ($current !== false) {
95 1
                        unset($this->info['settings'][$setting]);
96 1
                        $update = true;
97 1
                    }
98 1
                } elseif ($current !== $value) {
99 1
                    $this->info['settings'][$setting] = $value;
100 1
                    $update = true;
101 1
                }
102 1
                if ($update) {
103 1
                    $this->exec('UPDATE config SET settings = ?', serialize($this->info['settings']));
0 ignored issues
show
Documentation introduced by
serialize($this->info['settings']) is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
104 1
                }
105 1
                break;
106 1
        }
107 1
    }
108
109
    // http://stackoverflow.com/questions/396748/ordering-by-the-order-of-values-in-a-sql-in-clause
110 6
    public function orderIn($field, array $ids)
111
    {
112 6
        if (empty($ids)) {
113 1
            return '';
114
        }
115 6
        $count = 1;
116 6
        $order = 'ORDER BY CASE '.$field;
117 6
        foreach ($ids as $id) {
118 6
            $order .= ' WHEN '.$id.' THEN '.$count++;
119 6
        }
120 6
        $order .= ' ELSE NULL END ASC';
121
122 6
        return $order;
123
    }
124
125 1
    public function recreate($file)
126
    {
127 1
        if (is_file($file)) {
128 1
            return;
129
        }
130 1
        $virtual = $tables = $indexes = array();
131 1
        if ($result = $this->query('SELECT type, name, sql FROM sqlite_master')) {
132 1
            while (list($type, $name, $sql) = $this->fetch($result)) {
133 1
                if (!empty($sql)) {
134
                    switch ($type) {
135 1
                        case 'table':
136 1
                            $tables[$name] = $sql;
137 1
                            break;
138 1
                        case 'index':
139 1
                            $indexes[] = $sql;
140 1
                            break;
141
                    }
142 1
                }
143 1
            }
144 1
            $this->close($result);
145 1
        }
146 1
        foreach ($tables as $name => $sql) {
147 1
            if (strpos($sql, 'VIRTUAL TABLE')) {
148 1
                $virtual[] = $name;
149 1
            }
150 1
        }
151 1
        foreach ($virtual as $table) {
152 1
            foreach ($tables as $name => $sql) {
153 1
                if (strpos($name, "{$table}_") === 0) {
154 1
                    unset($tables[$name]);
155 1
                }
156 1
            }
157 1
        }
158 1
        $db = new self($file);
159 1
        $this->exec('ATTACH DATABASE '.$this->dbEscape($file).' AS recreate');
160 1
        foreach ($tables as $table => $sql) {
161 1
            $db->connection()->exec($sql);
162 1
            if ($fields = $this->row('SELECT * FROM '.$table.' LIMIT 1', '', 'assoc')) {
0 ignored issues
show
Documentation introduced by
'' is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
163 1
                $fields = implode(', ', array_keys($fields));
164 1
                $this->exec("INSERT INTO recreate.{$table} ({$fields}) SELECT * FROM {$table}");
165 1
            }
166 1
        }
167 1
        foreach ($indexes as $sql) {
168 1
            $db->connection()->exec($sql);
169 1
        }
170 1
        $db->connection()->close();
171 1
    }
172
173 1
    private function alter($table, array $fields, array $changes, $columns)
174
    {
175 1
        $map = array();
176 1
        if ($compare = $this->row('SELECT * FROM '.$table.' LIMIT 1', array(), 'assoc')) {
177 1
            foreach ($changes as $old => $new) {
178 1
                if (isset($fields[$new]) && isset($compare[$old])) {
179 1
                    $map[$old] = $new; // legitimate changes
180 1
                }
181 1
            }
182 1
            foreach (array_keys($compare) as $field) {
183 1
                if (isset($fields[$field]) && !isset($map[$field])) {
184 1
                    $map[$field] = $field; // old fields that match the new
185 1
                }
186 1
            }
187 1
        }
188 1
        $this->connection->exec('PRAGMA foreign_keys = OFF');
189 1
        $this->connection->exec('BEGIN IMMEDIATE');
190 1
        $result = true;
191 1
        if ($result !== false) {
192 1
            $result = $this->exec("CREATE TABLE {$table}_copy ({$columns})");
193 1
        }
194 1
        if (!empty($map)) {
195 1
            $new = implode(', ', array_values($map));
196 1
            $old = implode(', ', array_keys($map));
197 1
            if ($result !== false) {
198 1
                $result = $this->exec("INSERT INTO {$table}_copy ({$new}) SELECT {$old} FROM {$table}");
199 1
            }
200 1
        }
201 1
        if ($result !== false) {
202 1
            $result = $this->exec("DROP TABLE {$table}");
203 1
        }
204 1
        if ($result !== false) {
205 1
            $result = $this->exec("ALTER TABLE {$table}_copy RENAME TO {$table}");
206 1
        }
207 1
        $this->connection->exec($result !== false ? 'COMMIT' : 'ROLLBACK');
208 1
        $this->connection->exec('PRAGMA foreign_keys = ON');
209 1
    }
210
211 8
    private function index($table, $columns)
212
    {
213 8
        $queries = array();
214 8
        $outdated = $this->info('indexes', $table);
215 8
        if (empty($outdated)) {
216 8
            $outdated = array();
217 8
        }
218 8
        if (!empty($columns)) {
219 7
            foreach ((array) $columns as $key => $indexes) {
220 7
                $unique = (!is_int($key) && strtolower($key) == 'unique') ? ' UNIQUE ' : ' ';
221 7
                $indexes = array_map('trim', explode(',', $indexes));
222 7
                $name = $table.'_'.implode('_', $indexes);
223 7
                $sql = "CREATE{$unique}INDEX {$name} ON {$table} (".implode(', ', $indexes).')';
224 7
                $queries[$name] = $sql;
225 7
                if (!isset($outdated[$name]) || $outdated[$name] != $sql) {
226 7
                    if (isset($outdated[$name])) {
227 1
                        $this->exec('DROP INDEX '.$name);
228 1
                    }
229 7
                    $this->exec($sql);
230 7
                }
231 7
            }
232 7
            foreach ($outdated as $name => $sql) {
233 1
                if (!isset($queries[$name])) {
234 1
                    $this->exec('DROP INDEX '.$name);
235 1
                }
236 7
            }
237 7
            $this->info('indexes', $table, $queries);
238 7
        }
239 8
    }
240
241 9
    public function info($master) // only make public so that $this->fts can call it
242
    {
243 9
        if ($master == 'settings') {
244 1
            if (!isset($this->info['settings'])) {
245 1
                if ($this->create('config', array('settings' => 'TEXT NOT NULL DEFAULT ""'))) {
246 1
                    $this->exec('INSERT INTO config (settings) VALUES (?)', serialize(array()));
0 ignored issues
show
Documentation introduced by
serialize(array()) is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
247 1
                }
248 1
                $this->info['settings'] = array();
249 1
                if ($settings = $this->value('SELECT settings FROM config')) {
250 1
                    $this->info['settings'] = unserialize($settings);
251 1
                }
252 1
            }
253 9
        } elseif (!isset($this->info[$master])) { // 'tables' or 'indexes'
254 7
            if ($result = $this->query('SELECT type, name, tbl_name, sql FROM sqlite_master')) {
255 7
                while (list($type, $name, $table, $sql) = $this->fetch($result)) {
256
                    switch ($type) {
257 7
                        case 'table':
258 7
                            $this->info['tables'][$table] = $sql;
259 7
                            break;
260 7
                        case 'index':
261 7
                            if (!empty($sql)) {
262 7
                                $this->info['indexes'][$table][$name] = $sql;
263 7
                            }
264 7
                            break;
265
                    }
266 7
                }
267 7
                $this->close($result);
268 7
            }
269 7
        }
270 9
        switch (func_num_args()) {
271 9
            case 3:
272 9
                list($master, $name, $add) = func_get_args();
273 9
                $this->info[$master][$name] = $add;
274 9
                break;
275 9
            case 2:
276 9
                list($master, $name) = func_get_args();
277
278 9
                return (isset($this->info[$master][$name])) ? $this->info[$master][$name] : false;
279
                break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
280 1
            case 1:
281 1
                list($master) = func_get_args();
282
283 1
                return (isset($this->info[$master])) ? $this->info[$master] : false;
284
                break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
285 9
        }
286 9
    }
287
288 56
    protected function dbPrepare($query)
289
    {
290
        try {
291 56
            return $this->connection->prepare($query); // returns (mixed) $stmt object or false
292 2
        } catch (\Exception $e) {
293 2
            return false;
294
        }
295
    }
296
297 4
    protected function dbPrepareError()
298
    {
299 4
        return ($msg = $this->connection->lastErrorMsg()) ? 'Code: '.$this->connection->lastErrorCode()." Error: {$msg}" : false; // returns (string) error or false
0 ignored issues
show
Bug introduced by
The method lastErrorMsg does only exist in SQLite3, but not in PDO.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
Bug introduced by
The method lastErrorCode does only exist in SQLite3, but not in PDO.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
300
    }
301
302 55
    protected function dbExecute($stmt, array $values, $reference)
303
    {
304 55
        if (isset($this->prepared[$reference]['result'])) {
305 8
            $this->prepared[$reference]['result']->finalize();
306 8
            unset($this->prepared[$reference]['result']);
307 8
            $stmt->reset();
308 8
        }
309 55
        foreach (array_values($values) as $key => $value) {
310 48
            switch (gettype($value)) {
311 48
                case 'boolean':
312 48
                case 'integer':
313 29
                    $type = SQLITE3_INTEGER;
314 29
                    break;
315 48
                case 'double':
316 1
                    $type = SQLITE3_FLOAT;
317 1
                    break;
318 48
                case 'NULL':
319 1
                    $type = SQLITE3_NULL;
320 1
                    break;
321 48
                default:
322 48
                    $type = SQLITE3_TEXT;
323 48
                    break;
324 48
            }
325 48
            $stmt->bindValue($key + 1, $value, $type);
326 55
        }
327
        // Throws an ErrorException when a constraint fails eg. a (datatype mismatch)[https://www.sqlite.org/rescode.html#mismatch]
328
        try {
329 55
            if ($object = $stmt->execute()) {
330 55
                $this->prepared[$reference]['result'] = $object;
331 55
            }
332 55
        } catch (\Exception $e) {
333 1
            return false;
334
        }
335
        
336 55
        return ($object) ? true : false; // returns (bool) true or false
337
    }
338
339 2
    protected function dbExecuteError($stmt)
340
    {
341 2
        return $this->dbPrepareError(); // returns (string) error or false
342
    }
343
344 56
    protected function dbStyle($fetch)
345
    {
346
        switch ($fetch) {
347 56
            case 'assoc':
348 50
                return \SQLITE3_ASSOC;
349
                break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
350 39
            case 'both':
351 1
                return \SQLITE3_BOTH;
352
                break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
353 39
            default:
354 39
                return \SQLITE3_NUM;
355
                break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
356 39
        }
357
    }
358
359 55
    protected function dbFetch($stmt, $style, $reference)
360
    {
361 55
        return (isset($this->prepared[$reference]['result'])) ? $this->prepared[$reference]['result']->fetchArray($style) : false; // returns (mixed) $style or false
362
    }
363
364 16
    protected function dbInserted()
365
    {
366 16
        return $this->connection->lastInsertRowID(); // returns (int) last inserted row id or sequence value
0 ignored issues
show
Bug introduced by
The method lastInsertRowID does only exist in SQLite3, but not in PDO.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
367
    }
368
369 23
    protected function dbAffected($stmt)
370
    {
371 23
        return $this->connection->changes(); // returns (int) number of rows affected by last $stmt
0 ignored issues
show
Bug introduced by
The method changes does only exist in SQLite3, but not in PDO.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
372
    }
373
374 55
    protected function dbClose($stmt, $reference)
375
    {
376 55
        if (isset($this->prepared[$reference]['result'])) {
377 55
            $this->prepared[$reference]['result']->finalize();
378 55
            $this->prepared[$reference]['result'] = null;
379 55
        }
380
381 55
        return $stmt->close(); // returns (bool) true or false
382
    }
383
384 2
    protected function dbEscape($string)
385
    {
386 2
        return (is_numeric($string)) ? $string : "'".$this->connection->escapeString($string)."'";
0 ignored issues
show
Bug introduced by
The method escapeString does only exist in SQLite3, but not in PDO.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
387
    }
388
}
389