@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * |
| 66 | 66 | * @return array |
| 67 | 67 | */ |
| 68 | - public function createIndex($params = []) |
|
| 68 | + public function createIndex($params = [ ]) |
|
| 69 | 69 | { |
| 70 | 70 | return $this->client->indices()->create($this->mergeParams($params)); |
| 71 | 71 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * |
| 78 | 78 | * @return array |
| 79 | 79 | */ |
| 80 | - public function dropIndex($params = []) |
|
| 80 | + public function dropIndex($params = [ ]) |
|
| 81 | 81 | { |
| 82 | 82 | return $this->client->indices()->delete($this->mergeParams($params)); |
| 83 | 83 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | { |
| 18 | 18 | $query = self::buildQuery($params); |
| 19 | 19 | |
| 20 | - if(isset($object)) |
|
| 20 | + if (isset($object)) |
|
| 21 | 21 | { |
| 22 | 22 | $query = static::addType($object) + $query; |
| 23 | 23 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | 'query' => $params |
| 39 | 39 | ] |
| 40 | 40 | ]; |
| 41 | - if(isset($object)) |
|
| 41 | + if (isset($object)) |
|
| 42 | 42 | { |
| 43 | 43 | $query = static::addType($object) + $query; |
| 44 | 44 | } |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | protected static function addType($object) |
| 69 | 69 | { |
| 70 | - if(is_object($object)){ |
|
| 70 | + if (is_object($object)) { |
|
| 71 | 71 | $type = static::checkValidEloquent($object); |
| 72 | 72 | } |
| 73 | - else{ |
|
| 73 | + else { |
|
| 74 | 74 | $type = (new $object)->getTable(); |
| 75 | 75 | } |
| 76 | - return ["type"=>$type]; |
|
| 76 | + return [ "type"=>$type ]; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -69,8 +69,7 @@ discard block |
||
| 69 | 69 | { |
| 70 | 70 | if(is_object($object)){ |
| 71 | 71 | $type = static::checkValidEloquent($object); |
| 72 | - } |
|
| 73 | - else{ |
|
| 72 | + } else{ |
|
| 74 | 73 | $type = (new $object)->getTable(); |
| 75 | 74 | } |
| 76 | 75 | return ["type"=>$type]; |
@@ -137,10 +136,11 @@ discard block |
||
| 137 | 136 | */ |
| 138 | 137 | protected static function checkValidEloquent($object) |
| 139 | 138 | { |
| 140 | - if (is_subclass_of($object, '\Illuminate\Database\Eloquent\Model')) |
|
| 141 | - $type = $object->getTable(); |
|
| 142 | - else |
|
| 143 | - throw new NotValidEloquentException('Not a valid object, class should be extending Eloquent Model class.'); |
|
| 139 | + if (is_subclass_of($object, '\Illuminate\Database\Eloquent\Model')) { |
|
| 140 | + $type = $object->getTable(); |
|
| 141 | + } else { |
|
| 142 | + throw new NotValidEloquentException('Not a valid object, class should be extending Eloquent Model class.'); |
|
| 143 | + } |
|
| 144 | 144 | return $type; |
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | \ No newline at end of file |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | { |
| 67 | 67 | $password = str_random(7); |
| 68 | 68 | $input = $this->ask('For safety please enter this text "'.$password.'"'); |
| 69 | - if($input == $password){ |
|
| 69 | + if ($input == $password) { |
|
| 70 | 70 | return $this->buildIndex(); |
| 71 | 71 | } |
| 72 | 72 | else { |
@@ -86,11 +86,11 @@ discard block |
||
| 86 | 86 | $this->client->dropIndex(); |
| 87 | 87 | $response = $this->client->createIndex($this->params); |
| 88 | 88 | |
| 89 | - if(is_array($response) && $response['acknowledged'] == true) |
|
| 89 | + if (is_array($response) && $response[ 'acknowledged' ] == true) |
|
| 90 | 90 | { |
| 91 | 91 | $this->info('Index Initialization Successful'); |
| 92 | 92 | } |
| 93 | - else{ |
|
| 93 | + else { |
|
| 94 | 94 | $this->error('Index Initialization Failed'); |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -68,8 +68,7 @@ discard block |
||
| 68 | 68 | $input = $this->ask('For safety please enter this text "'.$password.'"'); |
| 69 | 69 | if($input == $password){ |
| 70 | 70 | return $this->buildIndex(); |
| 71 | - } |
|
| 72 | - else { |
|
| 71 | + } else { |
|
| 73 | 72 | return $this->error('Password is incorrect!'); |
| 74 | 73 | } |
| 75 | 74 | } |
@@ -89,8 +88,7 @@ discard block |
||
| 89 | 88 | if(is_array($response) && $response['acknowledged'] == true) |
| 90 | 89 | { |
| 91 | 90 | $this->info('Index Initialization Successful'); |
| 92 | - } |
|
| 93 | - else{ |
|
| 91 | + } else{ |
|
| 94 | 92 | $this->error('Index Initialization Failed'); |
| 95 | 93 | } |
| 96 | 94 | } |