/**
  * @return array
  */
 public function defaults()
 {
     $parentDefaults = parent::defaults();
     $defaults = array_replace_recursive($parentDefaults, ['enabled' => true, 'cookie_name' => 'charcoal_user_login', 'cookie_duration' => '15 days', 'https_only' => false]);
     return $defaults;
 }
Пример #2
0
 /**
  * @param ModelMetadata $metadata    The object metadata, where to find the object's
  *     source configuration.
  * @param string|null   $sourceIdent Optional. Custom source ident to load.
  *     If NULL, the default (from metadata) will be used.
  * @throws Exception If the source is not defined in the model's metadata.
  * @return SourceInterface
  */
 private function createSource(ModelMetadata $metadata, $sourceIdent = null)
 {
     if ($sourceIdent === null) {
         $sourceIdent = $metadata->defaultSource();
     }
     $sourceConfig = $metadata->source($sourceIdent);
     if (!$sourceConfig) {
         throw new Exception(sprintf('Can not create %s source: "%s" is not defined in metadata.', get_class($this), $sourceIdent));
     }
     $sourceType = isset($sourceConfig['type']) ? $sourceConfig['type'] : self::DEFAULT_SOURCE_TYPE;
     $source = $this->sourceFactory->create($sourceType);
     $source->setData($sourceConfig);
     return $source;
 }