![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/laminas/laminas-db/src/Sql/Platform/ |
<?php namespace Laminas\Db\Sql\Platform; use Laminas\Db\Adapter\AdapterInterface; use Laminas\Db\Adapter\Platform\PlatformInterface; use Laminas\Db\Adapter\StatementContainerInterface; use Laminas\Db\Sql\Exception; use Laminas\Db\Sql\PreparableSqlInterface; use Laminas\Db\Sql\SqlInterface; class AbstractPlatform implements PlatformDecoratorInterface, PreparableSqlInterface, SqlInterface { /** @var object|null */ protected $subject; /** @var PlatformDecoratorInterface[] */ protected $decorators = []; /** * {@inheritDoc} */ public function setSubject($subject) { $this->subject = $subject; return $this; } /** * @param string $type * @return void */ public function setTypeDecorator($type, PlatformDecoratorInterface $decorator) { $this->decorators[$type] = $decorator; } /** * @param PreparableSqlInterface|SqlInterface $subject * @return PlatformDecoratorInterface|PreparableSqlInterface|SqlInterface */ public function getTypeDecorator($subject) { foreach ($this->decorators as $type => $decorator) { if ($subject instanceof $type) { $decorator->setSubject($subject); return $decorator; } } return $subject; } /** * @return array|PlatformDecoratorInterface[] */ public function getDecorators() { return $this->decorators; } /** * {@inheritDoc} * * @throws Exception\RuntimeException */ public function prepareStatement(AdapterInterface $adapter, StatementContainerInterface $statementContainer) { if (! $this->subject instanceof PreparableSqlInterface) { throw new Exception\RuntimeException( 'The subject does not appear to implement Laminas\Db\Sql\PreparableSqlInterface, thus calling ' . 'prepareStatement() has no effect' ); } $this->getTypeDecorator($this->subject)->prepareStatement($adapter, $statementContainer); return $statementContainer; } /** * {@inheritDoc} * * @throws Exception\RuntimeException */ public function getSqlString(?PlatformInterface $adapterPlatform = null) { if (! $this->subject instanceof SqlInterface) { throw new Exception\RuntimeException( 'The subject does not appear to implement Laminas\Db\Sql\SqlInterface, thus calling ' . 'prepareStatement() has no effect' ); } return $this->getTypeDecorator($this->subject)->getSqlString($adapterPlatform); } }