-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from darrynten/dev
Prepping for Release
- Loading branch information
Showing
13 changed files
with
1,172 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
* @category Base | ||
* @package Clarifai | ||
* @author Darryn Ten <[email protected]> | ||
* @license MIT <https://github.com/darrynten/clarifai-php/LICENSE> | ||
* @license MIT <https://github.com/darrynten/clarifai-php/blob/master/LICENSE> | ||
* @link https://github.com/darrynten/clarifai-php | ||
*/ | ||
|
||
|
@@ -66,4 +66,26 @@ public function getInputRepository($config = null, $data = null) | |
{ | ||
return new Repository\InputRepository($this->getRequest(), $config, $data); | ||
} | ||
|
||
/** | ||
* @param $config | ||
* @param $data | ||
* | ||
* @return Repository\SearchInputRepository | ||
*/ | ||
public function getSearchInputRepository($config = null, $data = null) | ||
{ | ||
return new Repository\SearchInputRepository($this->getRequest(), $config, $data); | ||
} | ||
|
||
/** | ||
* @param $config | ||
* @param $data | ||
* | ||
* @return Repository\SearchModelRepository | ||
*/ | ||
public function getSearchModelRepository($config = null, $data = null) | ||
{ | ||
return new Repository\SearchModelRepository($this->getRequest(), $config, $data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
* @category Exception | ||
* @package Clarifai | ||
* @author Darryn Ten <[email protected]> | ||
* @license MIT <https://github.com/darrynten/clarifai-php/LICENSE> | ||
* @license MIT <https://github.com/darrynten/clarifai-php/blob/master/LICENSE> | ||
* @link https://github.com/darrynten/clarifai-php | ||
*/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
* @category Repository | ||
* @package Clarifai | ||
* @author Darryn Ten <[email protected]> | ||
* @license MIT <https://github.com/darrynten/clarifai-php/LICENSE> | ||
* @license MIT <https://github.com/darrynten/clarifai-php/blob/master/LICENSE> | ||
* @link https://github.com/darrynten/clarifai-php | ||
*/ | ||
|
||
|
@@ -25,6 +25,25 @@ abstract class BaseRepository | |
*/ | ||
private $request; | ||
|
||
/** | ||
* Number of the Page | ||
* | ||
* @var string $page | ||
*/ | ||
private $page; | ||
|
||
/** | ||
* Number of entities per page | ||
* | ||
* @var string $perPage | ||
*/ | ||
private $perPage; | ||
|
||
/** | ||
* BaseRepository constructor. | ||
* | ||
* @param RequestHandler $request | ||
*/ | ||
public function __construct(RequestHandler $request) | ||
{ | ||
$this->request = $request; | ||
|
@@ -37,4 +56,66 @@ protected function getRequest() | |
{ | ||
return $this->request; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getPage() | ||
{ | ||
return $this->page; | ||
} | ||
|
||
/** | ||
* @param string $page | ||
* | ||
* @return $this | ||
*/ | ||
public function setPage(string $page) | ||
{ | ||
$this->page = $page; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getPerPage() | ||
{ | ||
return $this->perPage; | ||
} | ||
|
||
/** | ||
* @param string $perPage | ||
* | ||
* @return $this | ||
*/ | ||
public function setPerPage(string $perPage) | ||
{ | ||
$this->perPage = $perPage; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getRequestPageInfo() | ||
{ | ||
return '?page=' . $this->getPage() . '&per_page=' . $this->getPerPage(); | ||
} | ||
|
||
/** | ||
* @param $url | ||
* | ||
* @return string | ||
*/ | ||
public function getRequestUrl($url) | ||
{ | ||
if ($this->getPerPage() && $this->getPage()) { | ||
return $url . $this->getRequestPageInfo(); | ||
} | ||
|
||
return $url; | ||
} | ||
} |
Oops, something went wrong.