config() публичный Метод

Set the config
public config ( null | string | array $config = null ) : null | string | array
$config null | string | array Null, string or array. Pass array of configs to set.
Результат null | string | array Returns Returns config value if $config is string, else returns config array.
Пример #1
0
 /**
  * Load PdfCrypto
  *
  * @param string $name Classname of crypto engine without `Crypto` suffix. For example `CakePdf.Pdftk`
  * @throws \Cake\Core\Exception\Exception
  * @return \CakePdf\Pdf\Crypto\AbstractPdfCrypto
  */
 public function crypto($name = null)
 {
     if ($name === null) {
         if ($this->_cryptoClass) {
             return $this->_cryptoClass;
         }
         throw new Exception(__d('cake_pdf', 'Crypto is not loaded'));
     }
     $config = [];
     if (is_array($name)) {
         $config = $name;
         $name = $name['className'];
     }
     $engineClassName = App::className($name, 'Pdf/Crypto', 'Crypto');
     if (!class_exists($engineClassName)) {
         throw new Exception(__d('cake_pdf', 'Pdf crypto "%s" not found', $name));
     }
     if (!is_subclass_of($engineClassName, 'CakePdf\\Pdf\\Crypto\\AbstractPdfCrypto')) {
         throw new Exception(__d('cake_pdf', 'Crypto engine must extend "AbstractPdfCrypto"'));
     }
     $this->_cryptoClass = new $engineClassName($this);
     $this->_cryptoClass->config($config);
     return $this->_cryptoClass;
 }