Browse Source

added interface for query, comments in code updated

tags/0.2
Paul Rock 7 years ago
parent
commit
6220b421d7
  1. 40
      src/Interfaces/QueryInterface.php
  2. 18
      src/Query.php

40
src/Interfaces/QueryInterface.php

@ -0,0 +1,40 @@
<?php
namespace RouterOS\Interfaces;
/**
* Interface QueryInterface
* @package RouterOS\Interfaces
* @since 0.2
*/
interface QueryInterface
{
/**
* Append to array yet another attribute of query
*
* @param string $word
* @return $this
*/
public function add(string $word): self;
/**
* Get attributes array of current query
*
* @return array
*/
public function getAttributes(): array;
/**
* Get endpoint of current query
*
* @return string
*/
public function getEndpoint(): string;
/**
* Build body of query
*
* @return array
*/
public function getQuery(): array;
}

18
src/Query.php

@ -2,10 +2,16 @@
namespace RouterOS;
class Query
{
use RouterOS\Interfaces\QueryInterface;
/**
* Class Query
* @package RouterOS
* @since 0.1
*/
class Query implements QueryInterface
{
/**
* Array of query attributes
* @var array
*/
@ -31,15 +37,17 @@ class Query
* Append to array yet another attribute of query
*
* @param string $word
* @return $this
* @return QueryInterface
*/
public function add(string $word): self
public function add(string $word): QueryInterface
{
$this->_attributes[] = $word;
return $this;
}
/**
* Get attributes array of current query
*
* @return array
*/
public function getAttributes(): array
@ -48,6 +56,8 @@ class Query
}
/**
* Get endpoint of current query
*
* @return string
*/
public function getEndpoint(): string

Loading…
Cancel
Save