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.
Completed
Push — master ( 803ce4...84c999 )
by Michael
14:57 queued 01:03
created

TPayloadLogger::hasLogContext()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * Copyright (c) 2013-2014 eBay Enterprise, Inc.
4
 *
5
 * NOTICE OF LICENSE
6
 *
7
 * This source file is subject to the Open Software License (OSL 3.0)
8
 * that is bundled with this package in the file LICENSE.md.
9
 * It is also available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * @copyright   Copyright (c) 2013-2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
13
 * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
14
 */
15
16
namespace eBayEnterprise\RetailOrderManagement\Payload;
17
18
/**
19
 * Generic implementation strategies for things logger have to do.
20
 *
21
 * trait TPayloadLogger
22
 * @package eBayEnterprise\RetailOrderManagement\Payload
23
 */
24
trait TPayloadLogger
25
{
26
    /**
27
     * Check if the logger has a method name 'getContext'.
28
     * @return bool
29
     */
30
    protected function hasLogContext()
31
    {
32
        return method_exists($this->logger, 'getContext');
0 ignored issues
show
Bug introduced by
The property logger does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
33
    }
34
35
    /**
36
     * Get an instance of the context class or null if not a valid logger.
37
     * @return mixed | null
38
     */
39
    protected function getLogContext()
40
    {
41
        return $this->hasLogContext() ? $this->logger->getContext() : null;
42
    }
43
44
    /**
45
     * Get context data from the logger if the logger has one.
46
     *
47
     * @param  string
48
     * @param  array
49
     * @return array
50
     */
51
    protected function getLogContextData($class, array $logData=[])
52
    {
53
        $context = $this->getLogContext();
54
        return $context ? $context->getMetaData($class, $logData) : $logData;
55
    }
56
}
57