public function __construct($method, $args)
 {
     parent::__construct($method, $args);
     $this->type = (new TypeOf())->when('int', function ($value) {
         return 'i:' . $value . ';';
     })->when('string', function ($value) {
         return 's:' . strlen($value) . ':"' . $value . '";';
     })->when(Type::$ARRAY, function ($value, $self) {
         $r = 'a:' . sizeof($value) . ':{';
         foreach ($value as $key => $val) {
             $r .= $self($key) . $self($val);
         }
         return $r . '}';
     })->when(null, function ($value) {
         return 'N;';
     });
     $this->native = function ($value) {
         if (null === $value) {
             return 'N;';
         } else {
             if (is_int($value)) {
                 return 'i:' . $value . ';';
             } else {
                 if (is_string($value)) {
                     return 's:' . strlen($value) . ':"' . $value . '";';
                 } else {
                     if (is_array($value)) {
                         $r = 'a:' . sizeof($value) . ':{';
                         $self = $this->native;
                         foreach ($value as $key => $val) {
                             $r .= $self($key) . $self($val);
                         }
                         return $r . '}';
                     }
                 }
             }
         }
     };
 }
 public function __construct($method, $args)
 {
     parent::__construct($method, $args);
     $this->value = (new ValueOf())->when(0, function () {
         return 'No elements';
     })->when(1, function () {
         return 'One element';
     })->otherwise(function ($value) {
         return $value . ' elements';
     });
     $this->key = (new KeyOf())->when(0, function () {
         return 'No elements';
     })->when(1, function () {
         return 'One element';
     })->otherwise(function ($value) {
         return $value . ' elements';
     });
     $this->if = function ($value) {
         if (0 === $value) {
             return 'No elements';
         } else {
             if (1 === $value) {
                 return 'One element';
             } else {
                 return $value . ' elements';
             }
         }
     };
     $this->switch = function ($value) {
         switch ($value) {
             case 0:
                 return 'No elements';
             case 1:
                 return 'One element';
             default:
                 return $value . ' elements';
         }
     };
 }