Completed
Push — master ( 398d0f...310d56 )
by Pascal
11:17 queued 06:22
created

AttributeModelNotSavedException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 34
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setModel() 0 8 1
A getModel() 0 4 1
1
<?php
2
3
namespace Pbmedia\Specifications\Laravel\Exceptions;
4
5
use RuntimeException;
6
7
class AttributeModelNotSavedException extends RuntimeException
8
{
9
    /**
10
     * Name of the affected Eloquent model.
11
     *
12
     * @var string
13
     */
14
    protected $model;
15
16
    /**
17
     * Set the affected Eloquent model.
18
     *
19
     * @param  string   $model
20
     * @return $this
21
     */
22
    public function setModel($model)
23
    {
24
        $this->model = $model;
25
26
        $this->message = "Attribute model with name [{$model->name}] has not been saved to the database yet.";
27
28
        return $this;
29
    }
30
31
    /**
32
     * Get the affected Eloquent model.
33
     *
34
     * @return string
35
     */
36
    public function getModel()
37
    {
38
        return $this->model;
39
    }
40
}
41