Exemplo n.º 1
0
 /**
  * among the other variables we need to have the column names for longitude and latitude added in here
  * 
  * @param array $options
  */
 public function __construct($options)
 {
     Ch::ek($options, $this->requiredFields);
     $this->latitudeColumn = $options['latitudeColumn'];
     $this->longitudeColumn = $options['longitudeColumn'];
     parent::__construct($options);
 }
 /**
  * @expectedException \RuntimeException 
  */
 public function testCanCheckOptions()
 {
     $required = ['opt1', 'opt2'];
     $options = ['opt1' => 1, 'opt2' => 'two'];
     // good on this one
     Ch::ek($options, $required);
     // blow up
     Ch::ek($options, array_merge($required, ['opt3']));
 }
 /**
  *
  * @param array $data            
  */
 public function loadData($data)
 {
     Ch::ek($data, $this->requiredOptions);
     foreach ($data as $name => $value) {
         if (!($df = $this->getField($name))) {
             throw new \RuntimeException("field not set {$name}");
         }
         $df->setData($value);
     }
     return $this;
 }
 /**
  * 
  *
  * @param array $options            
  */
 public function __construct($options)
 {
     Ch::ek($options, $this->requiredFields);
     $this->serializer = $options['serializer'];
     $this->callback = $options['callback'];
     // make sure that the serializer is set up properly
     if (!$this->serializer instanceof \Solvire\API\Serializers\BaseSerializer) {
         throw new \RuntimeException("Your serializer must be of type Solvire\\API\\Serializers\\BaseSerializer on " . $this->name);
     }
     parent::__construct($options);
 }
 /**
  * 
  *
  * @param array $options            
  */
 public function __construct($options)
 {
     Ch::ek($options, $this->requiredFields);
     $this->transformer = $options['transformer'];
     $this->callback = $options['callback'];
     // make sure that the transformer is set up properly
     if (!$this->transformer instanceof \League\Fractal\TransformerAbstract) {
         throw new \RuntimeException("Your transformer must be of type League\\Fractal\\TransformerAbstract on " . $this->name);
     }
     if (!method_exists($this->transformer, 'transform')) {
         throw new \RuntimeException("Your transformer must implement the transform function ");
     }
     parent::__construct($options);
 }