AttributeModelNotSavedException::setModel()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 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