1 | <?php |
||||
2 | |||||
3 | /* |
||||
4 | * This file is part of the PLASTIC package. |
||||
5 | * |
||||
6 | * (c) Jitendra Adhikari <[email protected]> |
||||
7 | * <https://github.com/adhocore> |
||||
8 | * |
||||
9 | * Licensed under MIT license. |
||||
10 | */ |
||||
11 | |||||
12 | require_once __DIR__ . '/src/Client.php'; |
||||
13 | |||||
14 | $schools = [[ |
||||
15 | 'id' => '1', |
||||
16 | 'name' => 'City School', |
||||
17 | 'addr' => 'City, Street, Province, Country', |
||||
18 | 'tags' => ['school', '1'], |
||||
19 | ], [ |
||||
20 | 'id' => '2', |
||||
21 | 'name' => 'City School 2', |
||||
22 | 'addr' => 'City 2, Street 2, Province 2, Country 2', |
||||
23 | 'tags' => ['school', '2'], |
||||
24 | ], |
||||
25 | ]; |
||||
26 | |||||
27 | $client = new Ahc\Plastic\Client(null, true); |
||||
28 | |||||
29 | foreach ($schools as $school) { |
||||
30 | $id = (string) $school['id']; |
||||
31 | |||||
32 | // post a school with given id |
||||
33 | echo $client->post->schools->school->$id($school); |
||||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() The property
schools does not exist on Ahc\Plastic\Client . Since you implemented __get , consider adding a @property annotation.
![]() The property
post does not exist on Ahc\Plastic\Client . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||
34 | |||||
35 | // find a school by id |
||||
36 | echo $client->get->schools->school->$id(); |
||||
0 ignored issues
–
show
The property
get does not exist on Ahc\Plastic\Client . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||
37 | } |
||||
38 | |||||
39 | echo $client->put->_cluster->settings([ |
||||
0 ignored issues
–
show
The method
settings() does not exist on Ahc\Plastic\Client . Since you implemented __call , consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() The property
put does not exist on Ahc\Plastic\Client . Since you implemented __get , consider adding a @property annotation.
![]() The property
_cluster does not exist on Ahc\Plastic\Client . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||
40 | 'persistent' => ['action.auto_create_index' => 'true'], |
||||
41 | ]); |
||||
42 | |||||
43 | $school3 = [ |
||||
44 | 'id' => '3', |
||||
45 | 'name' => 'City School 3', |
||||
46 | 'addr' => 'City 3, Street 3, Province 3, Country 3', |
||||
47 | 'tags' => ['school', '3'], |
||||
48 | ]; |
||||
49 | |||||
50 | // Create using put |
||||
51 | echo $client->put->schools->school->_3($school3, ['op_type' => 'create']); |
||||
0 ignored issues
–
show
The method
_3() does not exist on Ahc\Plastic\Client . Since you implemented __call , consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
52 | |||||
53 | // Get only source |
||||
54 | echo $client->get->schools->school->_3->_source(); |
||||
0 ignored issues
–
show
The property
_3 does not exist on Ahc\Plastic\Client . Since you implemented __get , consider adding a @property annotation.
![]() The method
_source() does not exist on Ahc\Plastic\Client . Since you implemented __call , consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
55 |