Browse Source

query class code style update

tags/0.6
Paul Rock 7 years ago
parent
commit
d471466e00
  1. 9
      src/Interfaces/QueryInterface.php
  2. 11
      src/Query.php

9
src/Interfaces/QueryInterface.php

@ -2,10 +2,13 @@
namespace RouterOS\Interfaces; namespace RouterOS\Interfaces;
use RouterOS\Query;
/** /**
* Interface QueryInterface * Interface QueryInterface
*
* @package RouterOS\Interfaces * @package RouterOS\Interfaces
* @since 0.2
* @since 0.2
*/ */
interface QueryInterface interface QueryInterface
{ {
@ -13,9 +16,9 @@ interface QueryInterface
* Append to array yet another attribute of query * Append to array yet another attribute of query
* *
* @param string $word * @param string $word
* @return QueryInterface
* @return Query
*/ */
public function add(string $word): QueryInterface;
public function add(string $word): Query;
/** /**
* Get attributes array of current query * Get attributes array of current query

11
src/Query.php

@ -6,19 +6,22 @@ use RouterOS\Interfaces\QueryInterface;
/** /**
* Class Query for building queries * Class Query for building queries
*
* @package RouterOS * @package RouterOS
* @since 0.1
* @since 0.1
*/ */
class Query implements QueryInterface class Query implements QueryInterface
{ {
/** /**
* Array of query attributes * Array of query attributes
*
* @var array * @var array
*/ */
private $_attributes = []; private $_attributes = [];
/** /**
* Endpoint of query * Endpoint of query
*
* @var string * @var string
*/ */
private $_endpoint; private $_endpoint;
@ -37,9 +40,9 @@ class Query implements QueryInterface
* Append to array yet another attribute of query * Append to array yet another attribute of query
* *
* @param string $word * @param string $word
* @return QueryInterface
* @return \RouterOS\Query
*/ */
public function add(string $word): QueryInterface
public function add(string $word): Query
{ {
$this->_attributes[] = $word; $this->_attributes[] = $word;
return $this; return $this;
@ -72,7 +75,7 @@ class Query implements QueryInterface
*/ */
public function getQuery(): array public function getQuery(): array
{ {
$endpoint = $this->getEndpoint();
$endpoint = $this->getEndpoint();
$attributes = $this->getAttributes(); $attributes = $this->getAttributes();
array_unshift($attributes, $endpoint); array_unshift($attributes, $endpoint);

Loading…
Cancel
Save