Beispiel #1
0
 public function __construct($array = null, $success = true)
 {
     if (!$success) {
         $this->exception = new SmsException($array);
     } else {
         if ($array) {
             Logs::warn('Constructor with JSON params in ' . get_class($this) . ' is deprecated, use Conversions utility class!');
             Conversions::fillFromJSON($this, $array, !$success);
         }
     }
 }
 public function __construct($arrayOrJson = null, $success = true)
 {
     // TODO: Remove this and use only the Conversions class
     if (!$success) {
         $this->exception = new SmsException($arrayOrJson);
     } else {
         if ($arrayOrJson) {
             Logs::warn('Constructor with JSON params in ' . get_class($this) . ' is deprecated, use Conversions utility class!');
             Conversions::fillFromJSON($this, $arrayOrJson, !$success);
         }
     }
 }
 public function convertFromJson($object, $json)
 {
     $values = Utils::getArrayValue($json, $this->jsonFieldName);
     if (!is_array($values)) {
         Logs::warn('Looking for array (', $this->jsonFieldName, '), but found:', $values);
         return null;
     }
     $result = array();
     foreach ($values as $value) {
         $result[] = Conversions::createFromJSON($this->className, $value, false);
     }
     $fieldName = $this->objectFieldName;
     $object->{$fieldName} = $result;
 }