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.

Code Duplication    Length = 40-41 lines in 2 locations

src/jwe/impl/JWEJOSEHeaderFactory.php 1 location

@@ 24-63 (lines=40) @@
21
 * Class JWEJOSEHeaderFactory
22
 * @package jwe\impl
23
 */
24
final class JWEJOSEHeaderFactory {
25
26
    static protected function getProductClass(){
27
        return  '\jwe\impl\JWEJOSEHeader';
28
    }
29
30
    /**
31
     * @param array $raw_headers
32
     * @return IJWEJOSEHeader
33
     */
34
    public static function build(array $raw_headers){
35
36
        $args = array();
37
38
        foreach(RegisteredJWEJOSEHeaderNames::$registered_basic_headers_set as $header_name){
39
            $value = isset($raw_headers[$header_name]) ? $raw_headers[$header_name] : null;
40
            $type  = @RegisteredJWEJOSEHeaderNames::$registered_basic_headers_set_types[$header_name];
41
            if(!is_null($value))
42
            {
43
                if(is_null($type)) continue;
44
                $class    = new \ReflectionClass($type);
45
                $value    = $class->newInstanceArgs(array($value));
46
            }
47
            array_push($args, $value);
48
            unset($raw_headers[$header_name]);
49
        }
50
51
52
        $class        = new \ReflectionClass(self::getProductClass());
53
        $basic_header = $class->newInstanceArgs($args);
54
55
        // unregistered headers
56
57
        foreach($raw_headers as $k => $v){
58
            $basic_header->addHeader(new JOSEHeaderParam($k, new JsonValue($v)));
59
        }
60
61
        return $basic_header;
62
    }
63
}

src/jwt/utils/JOSEHeaderFactory.php 1 location

@@ 26-66 (lines=41) @@
23
 * Class JOSEHeaderFactory
24
 * @package jwt\utils
25
 */
26
class JOSEHeaderFactory {
27
28
    static protected function getProductClass(){
29
        return  '\jwt\impl\JOSEHeader';
30
    }
31
32
    /**
33
     * @param array $raw_headers
34
     * @return IJOSEHeader
35
     */
36
    public static function build(array $raw_headers)
37
    {
38
39
        $args = array();
40
41
        foreach(RegisteredJOSEHeaderNames::$registered_basic_headers_set as $header_name){
42
            $value = isset($raw_headers[$header_name]) ? $raw_headers[$header_name] : null;
43
            $type  = @RegisteredJOSEHeaderNames::$registered_basic_headers_set_types[$header_name];
44
            if(!is_null($value))
45
            {
46
                if(is_null($type)) continue;
47
                $class    = new \ReflectionClass($type);
48
                $value    = $class->newInstanceArgs(array($value));
49
            }
50
            array_push($args, $value);
51
            unset($raw_headers[$header_name]);
52
        }
53
54
55
        $class        = new \ReflectionClass(self::getProductClass());
56
        $basic_header = $class->newInstanceArgs($args);
57
58
        // unregistered headers
59
60
        foreach($raw_headers as $k => $v){
61
            $basic_header->addHeader(new JOSEHeaderParam($k, new JsonValue($v)));
62
        }
63
64
        return $basic_header;
65
    }
66
}