public function accepts($type = null)
    {
        $raw = $this->parseAccept();
        $accept = [];
        foreach ($raw as $types) {
            $accept = array_merge($accept, $types);
        }
        if ($type === null) {
            return $accept;
        }

        return in_array($type, $accept);
    }
public function accepts($type = null)
    {
        $raw = $this->parseAccept();
        $accept = [];
        foreach ($raw as $types) {
            $accept = array_merge($accept, $types);
        }
        if ($type === null) {
            return $accept;
        }

        return in_array($type, $accept);
    }
public function accepts ( $ type = null ) { $ raw = $ this -> parseAccept ( ) ; $ accept = [ ] ; foreach ( $ raw as $ types ) { $ accept = array_merge ( $ accept , $ types ) ; } if ( $ type === null ) { return $ accept ; } return in_array ( $ type , $ accept ) ; }
Find out which content types the client accepts or check if they accept a
particular type of content.

#### Get all types:

```
$this->request->accepts();
```

#### Check for a single type:

```
$this->request->accepts('application/json');
```

This method will order the returned content types by the preference values indicated
by the client.

@param string|null $type The content type to check for. Leave null to get all types a client accepts.
@return array|bool Either an array of all the types the client accepts or a boolean if they accept the
provided type.
Find out which content types the client accepts or check if they accept a particular type of content .