| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- /* * ********************************************************************
- * ProxmoxVPS product developed. (2016-10-06)
- * *
- *
- * CREATED BY MODULESGARDEN -> http://modulesgarden.com
- * CONTACT -> contact@modulesgarden.com
- *
- *
- * This software is furnished under a license and may be used and copied
- * only in accordance with the terms of such license and with the
- * inclusion of the above copyright notice. This software or any other
- * copies thereof may not be provided or otherwise made available to any
- * other person. No title to and ownership of the software is hereby
- * transferred.
- *
- *
- * ******************************************************************** */
- namespace MGProvision\Proxmox\v2\repository;
- /**
- * Description of AbstractRepository
- *
- * @author Pawel Kopec <pawelk@modulesgarden.com>
- * @version 1.0.0
- */
- Abstract class AbstractRepository
- {
- protected $api;
- protected $fetch;
- public function setApi($api)
- {
- $this->api = $api;
- }
- /**
- *
- * @return \MGProvision\Proxmox\v2\Api
- */
- protected function api()
- {
- if ($this->api !== null)
- return $this->api;
- return $this->api = \MGProvision\Proxmox\v2\Api::getInstance();
- }
- abstract public function fetch();
- public function fetchArray()
- {
- $data = array();
- foreach ($this->fetch() as $entity)
- {
- $data[] = $entity->toArray();
- }
- return $data;
- }
- public function reset()
- {
- $this->fetch = null;
- return $this;
- }
- public function count()
- {
- return count($this->fetch());
- }
- }
|