original_string: protected function maybeMakeResource($type, $data, $status = 200) {
          $resourceName = $type . 'Resource';
          if(isset($this->$resourceName) && $this->$resourceName) {
              $class = $this->$resourceName;
              return (new $class($data))->response()
              ->setStatusCode($status);
          } elseif(is_bool($data)){
              return strval($data);
          } else {
              return $data;
          }
      }
code: protected function maybeMakeResource($type, $data, $status = 200) {
          $resourceName = $type . 'Resource';
          if(isset($this->$resourceName) && $this->$resourceName) {
              $class = $this->$resourceName;
              return (new $class($data))->response()
              ->setStatusCode($status);
          } elseif(is_bool($data)){
              return strval($data);
          } else {
              return $data;
          }
      }
code_tokens: protected function maybeMakeResource ( $ type , $ data , $ status = 200 ) { $ resourceName = $ type . 'Resource' ; if ( isset ( $ this -> $ resourceName ) && $ this -> $ resourceName ) { $ class = $ this -> $ resourceName ; return ( new $ class ( $ data ) ) -> response ( ) -> setStatusCode ( $ status ) ; } elseif ( is_bool ( $ data ) ) { return strval ( $ data ) ; } else { return $ data ; } }
docstring: If is defined return a Api Resource object
  
  @param string $type
  @param collection $data
  @return Resource | Model
docstring_tokens: If is defined return a Api Resource object