public function getResource(string $id = null): array
    {
        if ($id) {
            if (is_numeric($id)) {
                $filter = array_filter($this->resource, function ($row) use ($id) { return $row['id'] == $id; });
                return (array) array_pop($filter);
            }
            return (array) ($this->resource[$id] ?? []);
        }
        return $this->resource;
    }
public function getResource(string $id = null): array
    {
        if ($id) {
            if (is_numeric($id)) {
                $filter = array_filter($this->resource, function ($row) use ($id) { return $row['id'] == $id; });
                return (array) array_pop($filter);
            }
            return (array) ($this->resource[$id] ?? []);
        }
        return $this->resource;
    }
public function getResource ( string $ id = null ) : array { if ( $ id ) { if ( is_numeric ( $ id ) ) { $ filter = array_filter ( $ this -> resource , function ( $ row ) use ( $ id ) { return $ row [ 'id' ] == $ id ; } ) ; return ( array ) array_pop ( $ filter ) ; } return ( array ) ( $ this -> resource [ $ id ] ?? [ ] ) ; } return $ this -> resource ; }
Get resource.

@param string|null $id
@return array
Get resource .