Completed
Push — master ( 2af4ef...696bfb )
by Abdelrahman
02:07
created

src/Traits/CanVerifyPhone.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/*
4
 * NOTICE OF LICENSE
5
 *
6
 * Part of the Rinvex Fort Package.
7
 *
8
 * This source file is subject to The MIT License (MIT)
9
 * that is bundled with this package in the LICENSE file.
10
 *
11
 * Package: Rinvex Fort Package
12
 * License: The MIT License (MIT)
13
 * Link:    https://rinvex.com
14
 */
15
16
namespace Rinvex\Fort\Traits;
17
18
use Rinvex\Fort\Notifications\PhoneVerificationNotification;
19
20
trait CanVerifyPhone
21
{
22
    /**
23
     * Get the phone for verification.
24
     *
25
     * @return string
26
     */
27
    public function getPhoneForVerification()
28
    {
29
        return $this->phone;
30
    }
31
32
    /**
33
     * Get the country for verification.
34
     *
35
     * @return string
36
     */
37
    public function getCountryForVerification()
38
    {
39
        $country = country($this->country);
40
41
        return $country ? $country->getCallingCode() : null;
42
    }
43
44
    /**
45
     * Determine if phone is verified or not.
46
     *
47
     * @return bool
48
     */
49
    public function isPhoneVerified()
50
    {
51
        return (bool) $this->phone_verified;
52
    }
53
54
    /**
55
     * Send the phone verification notification.
56
     *
57
     * @param bool   $force
58
     * @param string $method
59
     *
60
     * @return void
61
     */
62
    public function sendPhoneVerificationNotification($force, $method)
63
    {
64
        $this->notify(new PhoneVerificationNotification($force, $method));
0 ignored issues
show
$force is of type boolean, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
$method is of type string, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
65
    }
66
}
67