GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 79eedc...e292ee )
by Piyapan
02:44
created

FlashToast::error()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace RaysTech\StarterKit\Supports;
4
5
use Illuminate\Support\Traits\Macroable;
6
use RaysTech\StarterKit\Supports\SessionStore;
7
8
class FlashToast
9
{
10
  use Macroable;
0 ignored issues
show
Bug introduced by
The trait Illuminate\Support\Traits\Macroable requires the property $name which is not provided by RaysTech\StarterKit\Supports\FlashToast.
Loading history...
11
    /**
12
     * The session store.
13
     *
14
     * @var SessionStore
15
     */
16
    protected $session;
17
    /**
18
     * The messages collection.
19
     *
20
     * @var \Illuminate\Support\Collection
21
     */
22
    public $messages;
23
    /**
24
     * Create a new FlashNotifier instance.
25
     *
26
     * @param SessionStore $session
27
     */
28
    function __construct(SessionStore $session)
29
    {
30
      $this->session = $session;
31
      $this->messages = collect();
32
    }
33
    /**
34
     * Flash an information message.
35
     *
36
     * @param  string|null $message
37
     * @return $this
38
     */
39
    public function info($message = null)
40
    {
41
      return $this->message($message, 'info');
42
    }
43
    /**
44
     * Flash a success message.
45
     *
46
     * @param  string|null $message
47
     * @return $this
48
     */
49
    public function success($message = null)
50
    {
51
      return $this->message($message, 'success');
52
    }
53
    /**
54
     * Flash an error message.
55
     *
56
     * @param  string|null $message
57
     * @return $this
58
     */
59
    public function error($message = null)
60
    {
61
      return $this->message($message, 'danger');
62
    }
63
    /**
64
     * Flash a warning message.
65
     *
66
     * @param  string|null $message
67
     * @return $this
68
     */
69
    public function warning($message = null)
70
    {
71
      return $this->message($message, 'warning');
72
    }
73
    /**
74
     * Flash a general message.
75
     *
76
     * @param  string|null $message
77
     * @param  string|null $level
78
     * @return $this
79
     */
80
    public function message($message = null, $level = null)
81
    {
82
        // If no message was provided, we should update
83
        // the most recently added message.
84
      if (! $message) {
85
        return $this->updateLastMessage(compact('level'));
86
      }
87
      if (! $message instanceof Message) {
0 ignored issues
show
Bug introduced by
The type RaysTech\StarterKit\Supports\Message was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
introduced by
$message is never a sub-type of RaysTech\StarterKit\Supports\Message.
Loading history...
88
        $message = new Message(compact('message', 'level'));
89
      }
90
      $this->messages->push($message);
91
      return $this->flash();
92
    }
93
    /**
94
     * Modify the most recently added message.
95
     *
96
     * @param  array $overrides
97
     * @return $this
98
     */
99
    protected function updateLastMessage($overrides = [])
100
    {
101
      $this->messages->last()->update($overrides);
102
      return $this;
103
    }
104
    /**
105
     * Flash an overlay modal.
106
     *
107
     * @param  string|null $message
108
     * @param  string      $title
109
     * @return $this
110
     */
111
    public function overlay($message = null, $title = 'Notice')
112
    {
113
      if (! $message) {
114
        return $this->updateLastMessage(['title' => $title, 'overlay' => true]);
115
      }
116
      return $this->message(
117
        new OverlayMessage(compact('title', 'message'))
0 ignored issues
show
Bug introduced by
The type RaysTech\StarterKit\Supports\OverlayMessage was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
118
      );
119
    }
120
    /**
121
     * Add an "important" flash to the session.
122
     *
123
     * @return $this
124
     */
125
    public function important()
126
    {
127
      return $this->updateLastMessage(['important' => true]);
128
    }
129
    /**
130
     * Clear all registered messages.
131
     *
132
     * @return $this
133
     */
134
    public function clear()
135
    {
136
      $this->messages = collect();
137
      return $this;
138
    }
139
    /**
140
     * Flash all messages to the session.
141
     */
142
    protected function flash()
143
    {
144
      $this->session->flash('flash_notification', $this->messages);
0 ignored issues
show
Bug introduced by
$this->messages of type Illuminate\Support\Collection is incompatible with the type array expected by parameter $data of RaysTech\StarterKit\Supports\SessionStore::flash(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

144
      $this->session->flash('flash_notification', /** @scrutinizer ignore-type */ $this->messages);
Loading history...
145
      return $this;
146
    }
147
  }