3ebd07f5b8d33c242f51309f49096ea8f0bf738a
[yaffs-website] / vendor / zendframework / zend-feed / src / PubSubHubbub / Model / AbstractModel.php
1 <?php
2 /**
3  * Zend Framework (http://framework.zend.com/)
4  *
5  * @link      http://github.com/zendframework/zf2 for the canonical source repository
6  * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
7  * @license   http://framework.zend.com/license/new-bsd New BSD License
8  */
9
10 namespace Zend\Feed\PubSubHubbub\Model;
11
12 use Zend\Db\TableGateway\TableGateway;
13 use Zend\Db\TableGateway\TableGatewayInterface;
14
15 class AbstractModel
16 {
17     /**
18      * Zend\Db\TableGateway\TableGatewayInterface instance to host database methods
19      *
20      * @var TableGatewayInterface
21      */
22     protected $db = null;
23
24     /**
25      * Constructor
26      *
27      * @param null|TableGatewayInterface $tableGateway
28      */
29     public function __construct(TableGatewayInterface $tableGateway = null)
30     {
31         if ($tableGateway === null) {
32             $parts = explode('\\', get_class($this));
33             $table = strtolower(array_pop($parts));
34             $this->db = new TableGateway($table, null);
35         } else {
36             $this->db = $tableGateway;
37         }
38     }
39 }