Completed
Push — phpscpec ( f31341...75ace1 )
by Anatoliy
04:42
created

ErrorHandler::errorHandle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 4
crap 1
1
<?php
2
declare(strict_types=1);
3
/**
4
 * Created by PhpStorm.
5
 * User: danchukas
6
 * Date: 2017-07-24 14:12
7
 */
8
9
namespace DanchukAS\DenyMultiplyRun;
10
11
/**
12
 * Class ErrorHandler
13
 * @package DanchukAS\DenyMultiplyRun
14
 */
15
class ErrorHandler
16
{
17
    /**
18
     * Для перехвата помилок що не кидають ексепшини.
19
     *
20
     * @var \LogicException
21
     */
22
    public static $lastError;
23
24
25
    public static function startErrorHandle()
26
    {
27
        \set_error_handler([__CLASS__, 'errorHandle']);
28
29
        self::$lastError = null;
30
        \set_error_handler([__CLASS__, 'errorHandle']);
31
32
        self::$lastError = null;
33
        \set_error_handler([__CLASS__, 'errorHandle']);
34
35
        self::$lastError = null;
36
        \set_error_handler([__CLASS__, 'errorHandle']);
37
38
        self::$lastError = null;
39
        \set_error_handler([__CLASS__, 'errorHandle']);
40
41
        self::$lastError = null;
42
        \set_error_handler([__CLASS__, 'errorHandle']);
43
44
        self::$lastError = null;
45
        \set_error_handler([__CLASS__, 'errorHandle']);
46
47
        self::$lastError = null;
48
        \set_error_handler([__CLASS__, 'errorHandle']);
49
50
        self::$lastError = null;
51
        \set_error_handler([__CLASS__, 'errorHandle']);
52
53
        self::$lastError = null;
54
        \set_error_handler([__CLASS__, 'errorHandle']);
55
56
        self::$lastError = null;
57
        \set_error_handler([__CLASS__, 'errorHandle']);
58
59
        self::$lastError = null;
60
        \set_error_handler([__CLASS__, 'errorHandle']);
61
62
        self::$lastError = null;
63
        \set_error_handler([__CLASS__, 'errorHandle']);
64
65
        self::$lastError = null;
66
        \set_error_handler([__CLASS__, 'errorHandle']);
67
68
        self::$lastError = null;
69
        \set_error_handler([__CLASS__, 'errorHandle']);
70
71
        self::$lastError = null;
72
        \set_error_handler([__CLASS__, 'errorHandle']);
73
74
        self::$lastError = null;
75
        \set_error_handler([__CLASS__, 'errorHandle']);
76
77
        self::$lastError = null;
78
        \set_error_handler([__CLASS__, 'errorHandle']);
79
80
        self::$lastError = null;
81
82
    }
0 ignored issues
show
Coding Style introduced by
Function closing brace must go on the next line following the body; found 1 blank lines before brace
Loading history...
83
//
84
//    /** @noinspection MoreThanThreeArgumentsInspection */
85
//    /**
86
//     * @param int $messageType
87
//     * @param string $messageText
88
//     * @param string $messageFile
89
//     * @param int $messageLine
90
//     *
91
//     * @return bool
92
//     */
93
//    public static function errorHandle(int $messageType, string $messageText, string $messageFile, int $messageLine)
94
//    {
95
//        // добавляємо лише інформацію яка є.
96
//        // все інше добавляти має обробник самого проекта.
97
//        $message = "[$messageType] $messageText in $messageFile on line $messageLine";
98
//
99
//        self::$lastError = new \LogicException($message);
100
//
101
//        // Перехопити перехопили, кидаєм далі обробляти.
102
//        return false;
103
//    }
104
105
106
}