Localization_Event::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * File containing the {@link Localization_Event} class.
4
 * @package Localization
5
 * @subpackage Events
6
 * @see Localization_Event
7
 */
8
9
declare(strict_types=1);
10
11
namespace AppLocalize;
12
13
/**
14
 * Base class for triggered event instances.
15
 *
16
 * @package Localization
17
 * @subpackage Events
18
 * @author Sebastian Mordziol <[email protected]>
19
 * @see Localization::triggerEvent()
20
 */
21
abstract class Localization_Event
22
{
23
   /**
24
    * @var array
25
    */
26
    protected $args;
27
    
28
    public function __construct(array $args)
29
    {
30
        $this->args = $args;
31
    }
32
33
   /**
34
    * Fetches the argument at the specified index in the 
35
    * event's arguments list, if it exists. 
36
    * 
37
    * @param int $index Zero-based index number.
38
    * @return mixed|NULL
39
    */ 
40
    public function getArgument(int $index)
41
    {
42
        if(isset($this->args[$index])) {
43
            return $this->args[$index];
44
        }
45
        
46
        return null;
47
    }
48
}
49