"Fossies" - the Fresh Open Source Software Archive

Member "drupal-9.4.5/vendor/laminas/laminas-feed/src/PubSubHubbub/Model/AbstractModel.php" (24 Mar 2022, 763 Bytes) of package /linux/www/drupal-9.4.5.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 <?php
    2 
    3 namespace Laminas\Feed\PubSubHubbub\Model;
    4 
    5 use Laminas\Db\TableGateway\TableGateway;
    6 use Laminas\Db\TableGateway\TableGatewayInterface;
    7 
    8 use function array_pop;
    9 use function explode;
   10 use function strtolower;
   11 
   12 class AbstractModel
   13 {
   14     /**
   15      * Laminas\Db\TableGateway\TableGatewayInterface instance to host database methods
   16      *
   17      * @var TableGatewayInterface
   18      */
   19     protected $db;
   20 
   21     public function __construct(?TableGatewayInterface $tableGateway = null)
   22     {
   23         if ($tableGateway === null) {
   24             $parts    = explode('\\', static::class);
   25             $table    = strtolower(array_pop($parts));
   26             $this->db = new TableGateway($table, null);
   27         } else {
   28             $this->db = $tableGateway;
   29         }
   30     }
   31 }