Code Duplication    Length = 35-35 lines in 2 locations

src/Metadata/MethodMetadata.php 1 location

@@ 5-39 (lines=35) @@
2
3
namespace Novaway\Component\OpenGraph\Metadata;
4
5
class MethodMetadata implements GraphMetadataInterface
6
{
7
    /** @var string */
8
    public $class;
9
10
    /** @var string */
11
    public $name;
12
13
    /** @var \ReflectionMethod */
14
    public $reflection;
15
16
17
    /**
18
     * Constructor
19
     *
20
     * @param string $class
21
     * @param string $name
22
     */
23
    public function __construct($class, $name)
24
    {
25
        $this->class = $class;
26
        $this->name  = $name;
27
28
        $this->reflection = new \ReflectionMethod($class, $name);
29
        $this->reflection->setAccessible(true);
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function getValue($containingValue)
36
    {
37
        return $this->reflection->invoke($containingValue);
38
    }
39
}
40

src/Metadata/PropertyMetadata.php 1 location

@@ 5-39 (lines=35) @@
2
3
namespace Novaway\Component\OpenGraph\Metadata;
4
5
class PropertyMetadata implements GraphMetadataInterface
6
{
7
    /** @var string */
8
    public $class;
9
10
    /** @var string */
11
    public $name;
12
13
    /** @var \ReflectionProperty */
14
    public $reflection;
15
16
17
    /**
18
     * Constructor
19
     *
20
     * @param string $class
21
     * @param string $name
22
     */
23
    public function __construct($class, $name)
24
    {
25
        $this->class = $class;
26
        $this->name  = $name;
27
28
        $this->reflection = new \ReflectionProperty($class, $name);
29
        $this->reflection->setAccessible(true);
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function getValue($containingValue)
36
    {
37
        return $this->reflection->getValue($containingValue);
38
    }
39
}
40