public function getCode(Exception $exception)
    {
        if (method_exists($exception, 'getCode') && $code = $exception->getCode())
            return $code;

        if (method_exists($exception, 'getStatusCode') && $code = $exception->getStatusCode())
            return $code;

        return null;
    }
public function getCode(Exception $exception)
    {
        if (method_exists($exception, 'getCode') && $code = $exception->getCode())
            return $code;

        if (method_exists($exception, 'getStatusCode') && $code = $exception->getStatusCode())
            return $code;

        return null;
    }
public function getCode ( Exception $ exception ) { if ( method_exists ( $ exception , 'getCode' ) && $ code = $ exception -> getCode ( ) ) return $ code ; if ( method_exists ( $ exception , 'getStatusCode' ) && $ code = $ exception -> getStatusCode ( ) ) return $ code ; return null ; }
Get the code from the exception.

@param  \Exception  $exception

@return int|mixed|null
Get the code from the exception .