Exemple #1
0
 public static function fromJson($json)
 {
     return FieldElement::fromArray(json_decode($json, true));
 }
Exemple #2
0
 /**
  * Get bytes presentation from a value.
  *
  * @param  mixed
  * @return FieldElement
  */
 public static function decodeInput($value)
 {
     if (is_string($value)) {
         return FieldElement::fromString($value);
     } else {
         if ($value instanceof FieldElement) {
             return $value;
         } else {
             if ($value instanceof SplFixedArray) {
                 return FieldElement::fromArray($value->toArray(), false);
             } else {
                 if ((array) $value === $value) {
                     return FieldElement::fromArray($value, false);
                 }
             }
         }
     }
     throw new SaltException('Unexpected input');
 }