Completed
Pull Request — master (#5)
by Samuel
03:56 queued 01:56
created

MissingScopeHandler   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 7 1
1
<?php
2
3
namespace SMartins\Exceptions\Handlers;
4
5
use SMartins\Exceptions\JsonApi\Error;
6
use SMartins\Exceptions\JsonApi\Source;
7
8
class MissingScopeHandler extends AbstractHandler
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function handle()
14
    {
15
        return (new Error)->setStatus(403)
16
            ->setCode($this->getCode('missing_scope'))
17
            ->setSource((new Source())->setPointer($this->getDefaultPointer()))
18
            ->setTitle($this->getDefaultTitle())
19
            ->setDetail($this->exception->getMessage());
20
    }
21
}
22