Example #1
0
 public static function fromJson($json)
 {
     return FieldElement::fromArray(json_decode($json, true));
 }
Example #2
0
File: Salt.php Project: rugk/Salt
 /**
  * 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');
 }