コード例 #1
0
 /**
  * Populate the configuration from an array of settings
  *
  * @param array $settings
  * @throws \InvalidArgumentException
  */
 public function populate($settings = array())
 {
     $publicVars = Introspection::getPublicVars($this);
     foreach ($settings as $name => $value) {
         if ($name === 'adapters') {
             if (!is_array($value)) {
                 throw new \InvalidArgumentException("adapter value must be an array " . print_r($value, true) . " given.");
             }
             foreach ($value as $adapterType) {
                 if (!$this->validAdapter($adapterType)) {
                     throw new \InvalidArgumentException("{$adapterType} is not a support adapter type. Supported Adapters " . implode("|", $this->supportedAdapters));
                 }
             }
         }
         if ($name === 'namespaces') {
             $this->setNamespaces($value);
         } elseif ($name === 'adapterFactory') {
             $this->setAdapterFactory($value);
         } elseif (array_key_exists($name, $publicVars)) {
             $this->{$name} = $value;
         } else {
             $this->settings[$name] = $value;
         }
     }
 }
コード例 #2
0
 /**
  * Get the currently set records
  *
  * @return \stdClass
  */
 public function getRecord()
 {
     return Introspection::getPublicVars($this);
 }
コード例 #3
0
 /**
  * Convert out object to a standard array.
  *
  * @return array
  */
 public function toArray()
 {
     return Introspection::getPublicVars($this);
 }