public function json(array $array = [], int $code = null)
  {
    $this->data = $array;

    if ($code != null) {
      $this->code = $code;
      header('HTTP/1.1 '.$this->code);
      return $this->send();
    }

    return $this;
  }
public function json(array $array = [], int $code = null)
  {
    $this->data = $array;

    if ($code != null) {
      $this->code = $code;
      header('HTTP/1.1 '.$this->code);
      return $this->send();
    }

    return $this;
  }
public function json ( array $ array = [ ] , int $ code = null ) { $ this -> data = $ array ; if ( $ code != null ) { $ this -> code = $ code ; header ( 'HTTP/1.1 ' . $ this -> code ) ; return $ this -> send ( ) ; } return $ this ; }
Attach json data

@param  array   $array
@param  integer $code
@return Rest
Attach json data