1 | <?php |
||
12 | class ElasticClient |
||
13 | { |
||
14 | protected $index, $params, $client; |
||
|
|||
15 | |||
16 | /** |
||
17 | * Connection constructor. |
||
18 | */ |
||
19 | public function __construct() |
||
39 | |||
40 | /** |
||
41 | * Merges Parameters received by client with index parameter |
||
42 | * |
||
43 | * @param $params |
||
44 | * |
||
45 | * @return array |
||
46 | */ |
||
47 | protected function mergeParams($params) |
||
51 | |||
52 | /** |
||
53 | * Returns the Elastic Search Client instance |
||
54 | * @return \Elasticsearch\Client |
||
55 | */ |
||
56 | public function getClient() |
||
60 | |||
61 | /** |
||
62 | * Creates the index with the given $params settings |
||
63 | * |
||
64 | * @param $params |
||
65 | * |
||
66 | * @return array |
||
67 | */ |
||
68 | public function createIndex($params = []) |
||
72 | |||
73 | /** |
||
74 | * Drops the index with the given $params settings |
||
75 | * |
||
76 | * @param $params |
||
77 | * |
||
78 | * @return array |
||
79 | */ |
||
80 | public function dropIndex($params = []) |
||
84 | |||
85 | /** |
||
86 | * Indexes a document of the given parameters |
||
87 | * |
||
88 | * @param $params |
||
89 | * |
||
90 | * @return array |
||
91 | */ |
||
92 | public function index($params) |
||
96 | |||
97 | /** |
||
98 | * Retrieves a document of the given parameters |
||
99 | * |
||
100 | * @param $params |
||
101 | * |
||
102 | * @return array |
||
103 | */ |
||
104 | public function get($params) |
||
108 | |||
109 | /** |
||
110 | * Updates a document of the given parameters |
||
111 | * |
||
112 | * @param $params |
||
113 | * |
||
114 | * @return array |
||
115 | */ |
||
116 | public function update($params) |
||
120 | |||
121 | /** |
||
122 | * Deletes a document of the given parameters |
||
123 | * |
||
124 | * @param $params |
||
125 | * |
||
126 | * @return array |
||
127 | */ |
||
128 | public function delete($params) |
||
132 | |||
133 | /** |
||
134 | * Searches the index with the given params |
||
135 | * |
||
136 | * @param $params |
||
137 | * |
||
138 | * @return array |
||
139 | */ |
||
140 | public function search($params) |
||
144 | } |
Only declaring a single property per statement allows you to later on add doc comments more easily.
It is also recommended by PSR2, so it is a common style that many people expect.