/** * @author Manuel Will <*****@*****.**> * @since 2015-08 * * @param array $credentials * * @throws SAP_Exception */ public static function init(array $credentials, $compileDirectory) { if (null !== self::$singleton) { throw new SAP_Exception('SapRfcDal is already initialized.'); } self::$singleton = new self($credentials, $compileDirectory); }
/** * @return null|SAP_Connection * @author Manuel Will * @since 2013 */ private function getConnection() { if (null === $this->connection) { $credentials = SAP_Factory::get()->getCredentials(); $this->connection = new SAP_Connection($credentials); } return $this->connection; }
<?php use Symfony\Component\Yaml\Yaml; include_once implode(DIRECTORY_SEPARATOR, [dirname(__DIR__), 'vendor', 'autoload.php']); $config = Yaml::parse(file_get_contents('config.yml')); SAP_Factory::init($config['credentials'], $config['compile-dir']);