Completed
Branch models-cleanup/model-relations (db5ca7)
by
unknown
13:03 queued 08:35
created
ui/browser/checkins/entities/CheckinStatusDashicon.php 1 patch
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -17,98 +17,98 @@
 block discarded – undo
17 17
 class CheckinStatusDashicon
18 18
 {
19 19
 
20
-    /**
21
-     * @var int $checkin_status
22
-     */
23
-    private $checkin_status;
20
+	/**
21
+	 * @var int $checkin_status
22
+	 */
23
+	private $checkin_status;
24 24
 
25 25
 
26
-    /**
27
-     * CheckinStatusDashicon constructor.
28
-     *
29
-     * @param int $checkin_status
30
-     */
31
-    public function __construct($checkin_status = EE_Checkin::status_checked_never)
32
-    {
33
-        $this->checkin_status = $checkin_status;
34
-    }
26
+	/**
27
+	 * CheckinStatusDashicon constructor.
28
+	 *
29
+	 * @param int $checkin_status
30
+	 */
31
+	public function __construct($checkin_status = EE_Checkin::status_checked_never)
32
+	{
33
+		$this->checkin_status = $checkin_status;
34
+	}
35 35
 
36 36
 
37
-    /**
38
-     * @param EE_Checkin $checkin
39
-     * @return CheckinStatusDashicon
40
-     * @throws EE_Error
41
-     */
42
-    public static function fromCheckin(EE_Checkin $checkin)
43
-    {
44
-        return new CheckinStatusDashicon(
45
-            $checkin->status()
46
-                ? EE_Checkin::status_checked_in
47
-                : EE_Checkin::status_checked_out
48
-        );
49
-    }
37
+	/**
38
+	 * @param EE_Checkin $checkin
39
+	 * @return CheckinStatusDashicon
40
+	 * @throws EE_Error
41
+	 */
42
+	public static function fromCheckin(EE_Checkin $checkin)
43
+	{
44
+		return new CheckinStatusDashicon(
45
+			$checkin->status()
46
+				? EE_Checkin::status_checked_in
47
+				: EE_Checkin::status_checked_out
48
+		);
49
+	}
50 50
 
51 51
 
52
-    /**
53
-     * @param EE_Registration $registration
54
-     * @param EE_Datetime     $datetime
55
-     * @return CheckinStatusDashicon
56
-     * @throws EE_Error
57
-     */
58
-    public static function fromRegistrationAndDatetime(EE_Registration $registration, EE_Datetime $datetime)
59
-    {
60
-        return new CheckinStatusDashicon(
61
-            $registration->check_in_status_for_datetime(
62
-                $datetime->ID()
63
-            )
64
-        );
65
-    }
52
+	/**
53
+	 * @param EE_Registration $registration
54
+	 * @param EE_Datetime     $datetime
55
+	 * @return CheckinStatusDashicon
56
+	 * @throws EE_Error
57
+	 */
58
+	public static function fromRegistrationAndDatetime(EE_Registration $registration, EE_Datetime $datetime)
59
+	{
60
+		return new CheckinStatusDashicon(
61
+			$registration->check_in_status_for_datetime(
62
+				$datetime->ID()
63
+			)
64
+		);
65
+	}
66 66
 
67 67
 
68
-    /**
69
-     * @param EE_Registration $registration
70
-     * @param int             $DTT_ID
71
-     * @return CheckinStatusDashicon
72
-     * @throws EE_Error
73
-     */
74
-    public static function fromRegistrationAndDatetimeId(EE_Registration $registration, $DTT_ID = 0)
75
-    {
76
-        return new CheckinStatusDashicon(
77
-            $registration->check_in_status_for_datetime(
78
-                absint($DTT_ID)
79
-            )
80
-        );
81
-    }
68
+	/**
69
+	 * @param EE_Registration $registration
70
+	 * @param int             $DTT_ID
71
+	 * @return CheckinStatusDashicon
72
+	 * @throws EE_Error
73
+	 */
74
+	public static function fromRegistrationAndDatetimeId(EE_Registration $registration, $DTT_ID = 0)
75
+	{
76
+		return new CheckinStatusDashicon(
77
+			$registration->check_in_status_for_datetime(
78
+				absint($DTT_ID)
79
+			)
80
+		);
81
+	}
82 82
 
83
-    /**
84
-     * Will return the correct set of dashicon css classes for the set checkin status
85
-     *
86
-     * @return string
87
-     */
88
-    public function cssClasses()
89
-    {
90
-        if ($this->checkin_status === EE_Checkin::status_checked_in) {
91
-            return "ee-dashicons ee-icon-check-in checkin-icons checkedin-status-{$this->checkin_status}";
92
-        }
93
-        if ($this->checkin_status === EE_Checkin::status_checked_out) {
94
-            return "ee-dashicons ee-icon-check-out checkin-icons checkedin-status-{$this->checkin_status}";
95
-        }
96
-        return "dashicons dashicons-no checkin-icons checkedin-status-{$this->checkin_status}";
97
-    }
83
+	/**
84
+	 * Will return the correct set of dashicon css classes for the set checkin status
85
+	 *
86
+	 * @return string
87
+	 */
88
+	public function cssClasses()
89
+	{
90
+		if ($this->checkin_status === EE_Checkin::status_checked_in) {
91
+			return "ee-dashicons ee-icon-check-in checkin-icons checkedin-status-{$this->checkin_status}";
92
+		}
93
+		if ($this->checkin_status === EE_Checkin::status_checked_out) {
94
+			return "ee-dashicons ee-icon-check-out checkin-icons checkedin-status-{$this->checkin_status}";
95
+		}
96
+		return "dashicons dashicons-no checkin-icons checkedin-status-{$this->checkin_status}";
97
+	}
98 98
 
99
-    /**
100
-     * returns a description for the Checkin Status Dashicon that can be used in List Table Legends
101
-     *
102
-     * @return string
103
-     */
104
-    public function legendLabel()
105
-    {
106
-        if ($this->checkin_status === EE_Checkin::status_checked_in) {
107
-            return esc_html__('This Registrant has been Checked In', 'event_espresso');
108
-        }
109
-        if ($this->checkin_status === EE_Checkin::status_checked_out) {
110
-            return esc_html__('This Registrant has been Checked Out', 'event_espresso');
111
-        }
112
-        return esc_html__('No Check-in Record has been Created for this Registrant', 'event_espresso');
113
-    }
99
+	/**
100
+	 * returns a description for the Checkin Status Dashicon that can be used in List Table Legends
101
+	 *
102
+	 * @return string
103
+	 */
104
+	public function legendLabel()
105
+	{
106
+		if ($this->checkin_status === EE_Checkin::status_checked_in) {
107
+			return esc_html__('This Registrant has been Checked In', 'event_espresso');
108
+		}
109
+		if ($this->checkin_status === EE_Checkin::status_checked_out) {
110
+			return esc_html__('This Registrant has been Checked Out', 'event_espresso');
111
+		}
112
+		return esc_html__('No Check-in Record has been Created for this Registrant', 'event_espresso');
113
+	}
114 114
 }
Please login to merge, or discard this patch.
core/exceptions/EntityNotFoundException.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -15,27 +15,27 @@
 block discarded – undo
15 15
 {
16 16
 
17 17
 
18
-    /**
19
-     * EntityNotFoundException constructor
20
-     *
21
-     * @param string     $identifier_type the name of the identifier used (ie: ID, Name, etc)
22
-     * @param string     $identifier      the actual data value used to retrieve the entity
23
-     * @param string     $message
24
-     * @param int        $code
25
-     * @param \Exception $previous
26
-     */
27
-    public function __construct($identifier_type, $identifier, $message = '', $code = 0, \Exception $previous = null)
28
-    {
29
-        if (empty($message)) {
30
-            $message = sprintf(
31
-                __(
32
-                    'The requested entity with %1$s="%2$s" was not found.',
33
-                    'event_espresso'
34
-                ),
35
-                $identifier_type,
36
-                $identifier
37
-            );
38
-        }
39
-        parent::__construct($message, $code, $previous);
40
-    }
18
+	/**
19
+	 * EntityNotFoundException constructor
20
+	 *
21
+	 * @param string     $identifier_type the name of the identifier used (ie: ID, Name, etc)
22
+	 * @param string     $identifier      the actual data value used to retrieve the entity
23
+	 * @param string     $message
24
+	 * @param int        $code
25
+	 * @param \Exception $previous
26
+	 */
27
+	public function __construct($identifier_type, $identifier, $message = '', $code = 0, \Exception $previous = null)
28
+	{
29
+		if (empty($message)) {
30
+			$message = sprintf(
31
+				__(
32
+					'The requested entity with %1$s="%2$s" was not found.',
33
+					'event_espresso'
34
+				),
35
+				$identifier_type,
36
+				$identifier
37
+			);
38
+		}
39
+		parent::__construct($message, $code, $previous);
40
+	}
41 41
 }
Please login to merge, or discard this patch.
core/exceptions/InvalidFormSubmissionException.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -13,25 +13,25 @@
 block discarded – undo
13 13
 {
14 14
 
15 15
 
16
-    /**
17
-     * InvalidFormSubmissionException constructor
18
-     *
19
-     * @param string     $form_name
20
-     * @param string     $message
21
-     * @param int        $code
22
-     * @param \Exception $previous
23
-     */
24
-    public function __construct($form_name, $message = '', $code = 0, \Exception $previous = null)
25
-    {
26
-        if (empty($message)) {
27
-            $message = sprintf(
28
-                __(
29
-                    'The data for the "%1$s" form, is either missing or was not submitted properly.',
30
-                    'event_espresso'
31
-                ),
32
-                $form_name
33
-            );
34
-        }
35
-        parent::__construct($message, $code, $previous);
36
-    }
16
+	/**
17
+	 * InvalidFormSubmissionException constructor
18
+	 *
19
+	 * @param string     $form_name
20
+	 * @param string     $message
21
+	 * @param int        $code
22
+	 * @param \Exception $previous
23
+	 */
24
+	public function __construct($form_name, $message = '', $code = 0, \Exception $previous = null)
25
+	{
26
+		if (empty($message)) {
27
+			$message = sprintf(
28
+				__(
29
+					'The data for the "%1$s" form, is either missing or was not submitted properly.',
30
+					'event_espresso'
31
+				),
32
+				$form_name
33
+			);
34
+		}
35
+		parent::__construct($message, $code, $previous);
36
+	}
37 37
 }
Please login to merge, or discard this patch.
core/exceptions/InvalidClassException.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -15,22 +15,22 @@
 block discarded – undo
15 15
 class InvalidClassException extends DomainException
16 16
 {
17 17
 
18
-    /**
19
-     * InvalidClassException constructor.
20
-     *
21
-     * @param string     $class_name
22
-     * @param string     $message
23
-     * @param int        $code
24
-     * @param \Exception $previous
25
-     */
26
-    public function __construct($class_name, $message = '', $code = 0, \Exception $previous = null)
27
-    {
28
-        if (empty($message)) {
29
-            $message = sprintf(
30
-                __('The "%1$s" Class is either missing or invalid.', 'event_espresso'),
31
-                $class_name
32
-            );
33
-        }
34
-        parent::__construct($message, $code, $previous);
35
-    }
18
+	/**
19
+	 * InvalidClassException constructor.
20
+	 *
21
+	 * @param string     $class_name
22
+	 * @param string     $message
23
+	 * @param int        $code
24
+	 * @param \Exception $previous
25
+	 */
26
+	public function __construct($class_name, $message = '', $code = 0, \Exception $previous = null)
27
+	{
28
+		if (empty($message)) {
29
+			$message = sprintf(
30
+				__('The "%1$s" Class is either missing or invalid.', 'event_espresso'),
31
+				$class_name
32
+			);
33
+		}
34
+		parent::__construct($message, $code, $previous);
35
+	}
36 36
 }
Please login to merge, or discard this patch.
core/exceptions/IpnException.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -15,66 +15,66 @@
 block discarded – undo
15 15
 class IpnException extends \LogicException
16 16
 {
17 17
 
18
-    const DUPLICATE = 1;
18
+	const DUPLICATE = 1;
19 19
 
20
-    const UNABLE_TO_VALIDATE = 2;
20
+	const UNABLE_TO_VALIDATE = 2;
21 21
 
22
-    const UNSUPPORTED = 3;
22
+	const UNSUPPORTED = 3;
23 23
 
24
-    /**
25
-     * @var \EE_Payment
26
-     */
27
-    protected $payment;
24
+	/**
25
+	 * @var \EE_Payment
26
+	 */
27
+	protected $payment;
28 28
 
29
-    /**
30
-     * @var mixed IPN data, usually an array or object
31
-     */
32
-    protected $ipn_data;
29
+	/**
30
+	 * @var mixed IPN data, usually an array or object
31
+	 */
32
+	protected $ipn_data;
33 33
 
34 34
 
35
-    public function __construct(
36
-        $message,
37
-        $code = 0,
38
-        \Exception $previous = null,
39
-        \EE_Payment $payment = null,
40
-        $ipn_data = array()
41
-    ) {
42
-        parent::__construct($message, $code, $previous);
43
-        $this->payment = $payment;
44
-        $this->ipn_data = $ipn_data;
45
-    }
35
+	public function __construct(
36
+		$message,
37
+		$code = 0,
38
+		\Exception $previous = null,
39
+		\EE_Payment $payment = null,
40
+		$ipn_data = array()
41
+	) {
42
+		parent::__construct($message, $code, $previous);
43
+		$this->payment = $payment;
44
+		$this->ipn_data = $ipn_data;
45
+	}
46 46
 
47 47
 
48
-    /**
49
-     * Gets the payment associated with this IPN, if known
50
-     *
51
-     * @return \EE_Payment
52
-     */
53
-    public function getPayment()
54
-    {
55
-        return $this->payment;
56
-    }
48
+	/**
49
+	 * Gets the payment associated with this IPN, if known
50
+	 *
51
+	 * @return \EE_Payment
52
+	 */
53
+	public function getPayment()
54
+	{
55
+		return $this->payment;
56
+	}
57 57
 
58 58
 
59
-    /**
60
-     * Returns the payment's properties as an array (even if there is no payment, in which case it's an empty array)
61
-     *
62
-     * @return array
63
-     * @throws \EE_Error
64
-     */
65
-    public function getPaymentProperties()
66
-    {
67
-        return $this->getPayment() instanceof \EE_Payment ? $this->getPayment()->model_field_array() : array();
68
-    }
59
+	/**
60
+	 * Returns the payment's properties as an array (even if there is no payment, in which case it's an empty array)
61
+	 *
62
+	 * @return array
63
+	 * @throws \EE_Error
64
+	 */
65
+	public function getPaymentProperties()
66
+	{
67
+		return $this->getPayment() instanceof \EE_Payment ? $this->getPayment()->model_field_array() : array();
68
+	}
69 69
 
70 70
 
71
-    /**
72
-     * Returns an array, object, or string, however, the IPN data was received
73
-     *
74
-     * @return mixed
75
-     */
76
-    public function getIpnData()
77
-    {
78
-        return $this->ipn_data;
79
-    }
71
+	/**
72
+	 * Returns an array, object, or string, however, the IPN data was received
73
+	 *
74
+	 * @return mixed
75
+	 */
76
+	public function getIpnData()
77
+	{
78
+		return $this->ipn_data;
79
+	}
80 80
 }
Please login to merge, or discard this patch.
core/exceptions/InvalidSessionDataException.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -12,18 +12,18 @@
 block discarded – undo
12 12
 class InvalidSessionDataException extends \Exception
13 13
 {
14 14
 
15
-    /**
16
-     * InvalidInterfaceException constructor.
17
-     *
18
-     * @param string     $message
19
-     * @param int        $code
20
-     * @param \Exception $previous
21
-     */
22
-    public function __construct($message = '', $code = 0, \Exception $previous = null)
23
-    {
24
-        if (empty($message)) {
25
-            $message = esc_html__('The session data is either missing or invalid.', 'event_espresso');
26
-        }
27
-        parent::__construct($message, $code, $previous);
28
-    }
15
+	/**
16
+	 * InvalidInterfaceException constructor.
17
+	 *
18
+	 * @param string     $message
19
+	 * @param int        $code
20
+	 * @param \Exception $previous
21
+	 */
22
+	public function __construct($message = '', $code = 0, \Exception $previous = null)
23
+	{
24
+		if (empty($message)) {
25
+			$message = esc_html__('The session data is either missing or invalid.', 'event_espresso');
26
+		}
27
+		parent::__construct($message, $code, $previous);
28
+	}
29 29
 }
Please login to merge, or discard this patch.
core/exceptions/ExceptionLogger.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -14,39 +14,39 @@
 block discarded – undo
14 14
 {
15 15
 
16 16
 
17
-    /**
18
-     * ExceptionLogger constructor.
19
-     *
20
-     * @param \Exception $exception
21
-     */
22
-    public function __construct(\Exception $exception)
23
-    {
24
-        $this->log($exception);
25
-    }
17
+	/**
18
+	 * ExceptionLogger constructor.
19
+	 *
20
+	 * @param \Exception $exception
21
+	 */
22
+	public function __construct(\Exception $exception)
23
+	{
24
+		$this->log($exception);
25
+	}
26 26
 
27 27
 
28
-    /**
29
-     * write exception details to log file
30
-     *
31
-     * @param \Exception $exception
32
-     * @param int        $time
33
-     */
34
-    public function log(\Exception $exception, $time = 0)
35
-    {
36
-        if (! $time) {
37
-            $time = time();
38
-        }
39
-        $exception_log = '----------------------------------------------------------------------------------------';
40
-        $exception_log .= PHP_EOL;
41
-        $exception_log .= '[' . date('Y-m-d H:i:s', $time) . ']  Exception Details' . PHP_EOL;
42
-        $exception_log .= 'Message: ' . $exception->getMessage() . PHP_EOL;
43
-        $exception_log .= 'Code: ' . $exception->getCode() . PHP_EOL;
44
-        $exception_log .= 'File: ' . $exception->getFile() . PHP_EOL;
45
-        $exception_log .= 'Line No: ' . $exception->getLine() . PHP_EOL;
46
-        $exception_log .= 'Stack trace: ' . PHP_EOL;
47
-        $exception_log .= $exception->getTraceAsString() . PHP_EOL;
48
-        $exception_log .= '----------------------------------------------------------------------------------------';
49
-        $exception_log .= PHP_EOL;
50
-        error_log($exception_log);
51
-    }
28
+	/**
29
+	 * write exception details to log file
30
+	 *
31
+	 * @param \Exception $exception
32
+	 * @param int        $time
33
+	 */
34
+	public function log(\Exception $exception, $time = 0)
35
+	{
36
+		if (! $time) {
37
+			$time = time();
38
+		}
39
+		$exception_log = '----------------------------------------------------------------------------------------';
40
+		$exception_log .= PHP_EOL;
41
+		$exception_log .= '[' . date('Y-m-d H:i:s', $time) . ']  Exception Details' . PHP_EOL;
42
+		$exception_log .= 'Message: ' . $exception->getMessage() . PHP_EOL;
43
+		$exception_log .= 'Code: ' . $exception->getCode() . PHP_EOL;
44
+		$exception_log .= 'File: ' . $exception->getFile() . PHP_EOL;
45
+		$exception_log .= 'Line No: ' . $exception->getLine() . PHP_EOL;
46
+		$exception_log .= 'Stack trace: ' . PHP_EOL;
47
+		$exception_log .= $exception->getTraceAsString() . PHP_EOL;
48
+		$exception_log .= '----------------------------------------------------------------------------------------';
49
+		$exception_log .= PHP_EOL;
50
+		error_log($exception_log);
51
+	}
52 52
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -33,18 +33,18 @@
 block discarded – undo
33 33
      */
34 34
     public function log(\Exception $exception, $time = 0)
35 35
     {
36
-        if (! $time) {
36
+        if ( ! $time) {
37 37
             $time = time();
38 38
         }
39 39
         $exception_log = '----------------------------------------------------------------------------------------';
40 40
         $exception_log .= PHP_EOL;
41
-        $exception_log .= '[' . date('Y-m-d H:i:s', $time) . ']  Exception Details' . PHP_EOL;
42
-        $exception_log .= 'Message: ' . $exception->getMessage() . PHP_EOL;
43
-        $exception_log .= 'Code: ' . $exception->getCode() . PHP_EOL;
44
-        $exception_log .= 'File: ' . $exception->getFile() . PHP_EOL;
45
-        $exception_log .= 'Line No: ' . $exception->getLine() . PHP_EOL;
46
-        $exception_log .= 'Stack trace: ' . PHP_EOL;
47
-        $exception_log .= $exception->getTraceAsString() . PHP_EOL;
41
+        $exception_log .= '['.date('Y-m-d H:i:s', $time).']  Exception Details'.PHP_EOL;
42
+        $exception_log .= 'Message: '.$exception->getMessage().PHP_EOL;
43
+        $exception_log .= 'Code: '.$exception->getCode().PHP_EOL;
44
+        $exception_log .= 'File: '.$exception->getFile().PHP_EOL;
45
+        $exception_log .= 'Line No: '.$exception->getLine().PHP_EOL;
46
+        $exception_log .= 'Stack trace: '.PHP_EOL;
47
+        $exception_log .= $exception->getTraceAsString().PHP_EOL;
48 48
         $exception_log .= '----------------------------------------------------------------------------------------';
49 49
         $exception_log .= PHP_EOL;
50 50
         error_log($exception_log);
Please login to merge, or discard this patch.
core/exceptions/InvalidFilePathException.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -15,27 +15,27 @@
 block discarded – undo
15 15
 class InvalidFilePathException extends InvalidArgumentException
16 16
 {
17 17
 
18
-    /**
19
-     * InvalidClassException constructor.
20
-     *
21
-     * @param string     $file_path
22
-     * @param string     $message
23
-     * @param int        $code
24
-     * @param \Exception $previous
25
-     */
26
-    public function __construct($file_path, $message = '', $code = 0, \Exception $previous = null)
27
-    {
28
-        if (empty($message)) {
29
-            $message = sprintf(
30
-                __(
31
-                    'The "%1$s" file is either missing or could not be read due to permissions. Please ensure that the following path is correct and verify that the file permissions are correct:%2$s %3$s',
32
-                    'event_espresso'
33
-                ),
34
-                basename($file_path),
35
-                '<br />',
36
-                $file_path
37
-            );
38
-        }
39
-        parent::__construct($message, $code, $previous);
40
-    }
18
+	/**
19
+	 * InvalidClassException constructor.
20
+	 *
21
+	 * @param string     $file_path
22
+	 * @param string     $message
23
+	 * @param int        $code
24
+	 * @param \Exception $previous
25
+	 */
26
+	public function __construct($file_path, $message = '', $code = 0, \Exception $previous = null)
27
+	{
28
+		if (empty($message)) {
29
+			$message = sprintf(
30
+				__(
31
+					'The "%1$s" file is either missing or could not be read due to permissions. Please ensure that the following path is correct and verify that the file permissions are correct:%2$s %3$s',
32
+					'event_espresso'
33
+				),
34
+				basename($file_path),
35
+				'<br />',
36
+				$file_path
37
+			);
38
+		}
39
+		parent::__construct($message, $code, $previous);
40
+	}
41 41
 }
Please login to merge, or discard this patch.
core/exceptions/InvalidDataTypeException.php 2 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -16,46 +16,46 @@
 block discarded – undo
16 16
 class InvalidDataTypeException extends InvalidArgumentException
17 17
 {
18 18
 
19
-    /**
20
-     * InvalidDataTypeException constructor
21
-     *
22
-     * @param string    $var_name  name of the variable that was of the wrong type ie: "$my_var"
23
-     * @param mixed     $variable  the actual variable that was of the wrong data type, ie: $my_var
24
-     * @param string    $expected  data type we wanted ie: "integer", "string", "array", etc.
25
-     *                             or an entire rewrite of: "{something something} was expected."
26
-     * @param string    $message
27
-     * @param int       $code
28
-     * @param Exception $previous
29
-     */
30
-    public function __construct($var_name, $variable, $expected, $message = '', $code = 0, Exception $previous = null)
31
-    {
32
-        if (empty($message)) {
33
-            $expected = strpos(' was expected.', $expected) === false
34
-                ? $this->addIndefiniteArticle($expected) . ' was expected.'
35
-                : $expected;
36
-            $message = sprintf(
37
-                __(
38
-                    'The supplied data for "%1$s" was %2$s, but %3$s',
39
-                    'event_espresso'
40
-                ),
41
-                $var_name,
42
-                $this->addIndefiniteArticle(gettype($variable)),
43
-                $expected
44
-            );
45
-        }
46
-        parent::__construct($message, $code, $previous);
47
-    }
19
+	/**
20
+	 * InvalidDataTypeException constructor
21
+	 *
22
+	 * @param string    $var_name  name of the variable that was of the wrong type ie: "$my_var"
23
+	 * @param mixed     $variable  the actual variable that was of the wrong data type, ie: $my_var
24
+	 * @param string    $expected  data type we wanted ie: "integer", "string", "array", etc.
25
+	 *                             or an entire rewrite of: "{something something} was expected."
26
+	 * @param string    $message
27
+	 * @param int       $code
28
+	 * @param Exception $previous
29
+	 */
30
+	public function __construct($var_name, $variable, $expected, $message = '', $code = 0, Exception $previous = null)
31
+	{
32
+		if (empty($message)) {
33
+			$expected = strpos(' was expected.', $expected) === false
34
+				? $this->addIndefiniteArticle($expected) . ' was expected.'
35
+				: $expected;
36
+			$message = sprintf(
37
+				__(
38
+					'The supplied data for "%1$s" was %2$s, but %3$s',
39
+					'event_espresso'
40
+				),
41
+				$var_name,
42
+				$this->addIndefiniteArticle(gettype($variable)),
43
+				$expected
44
+			);
45
+		}
46
+		parent::__construct($message, $code, $previous);
47
+	}
48 48
 
49 49
 
50
-    /**
51
-     * @param $string
52
-     * @return string
53
-     */
54
-    protected function addIndefiniteArticle($string)
55
-    {
56
-        if (strtolower($string) === 'null') {
57
-            return $string;
58
-        }
59
-        return (stripos('aeiou', $string[0]) !== false ? 'an ' : 'a ') . $string;
60
-    }
50
+	/**
51
+	 * @param $string
52
+	 * @return string
53
+	 */
54
+	protected function addIndefiniteArticle($string)
55
+	{
56
+		if (strtolower($string) === 'null') {
57
+			return $string;
58
+		}
59
+		return (stripos('aeiou', $string[0]) !== false ? 'an ' : 'a ') . $string;
60
+	}
61 61
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     {
32 32
         if (empty($message)) {
33 33
             $expected = strpos(' was expected.', $expected) === false
34
-                ? $this->addIndefiniteArticle($expected) . ' was expected.'
34
+                ? $this->addIndefiniteArticle($expected).' was expected.'
35 35
                 : $expected;
36 36
             $message = sprintf(
37 37
                 __(
@@ -56,6 +56,6 @@  discard block
 block discarded – undo
56 56
         if (strtolower($string) === 'null') {
57 57
             return $string;
58 58
         }
59
-        return (stripos('aeiou', $string[0]) !== false ? 'an ' : 'a ') . $string;
59
+        return (stripos('aeiou', $string[0]) !== false ? 'an ' : 'a ').$string;
60 60
     }
61 61
 }
Please login to merge, or discard this patch.