1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Cli\Configuration\Logger\Formatter |
5
|
|
|
* |
6
|
|
|
* NOTICE OF LICENSE |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
9
|
|
|
* that is available through the world-wide-web at this URL: |
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
11
|
|
|
* |
12
|
|
|
* PHP version 5 |
13
|
|
|
* |
14
|
|
|
* @author Tim Wagner <[email protected]> |
15
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
16
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
17
|
|
|
* @link https://github.com/techdivision/import-cli-simple |
18
|
|
|
* @link http://www.techdivision.com |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace TechDivision\Import\Cli\Configuration\Logger; |
22
|
|
|
|
23
|
|
|
use JMS\Serializer\Annotation\Type; |
24
|
|
|
use JMS\Serializer\Annotation\SerializedName; |
25
|
|
|
use TechDivision\Import\Cli\Configuration\ParamsTrait; |
26
|
|
|
use TechDivision\Import\Configuration\Logger\FormatterConfigurationInterface; |
|
|
|
|
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* The handler's formatter configuration. |
30
|
|
|
* |
31
|
|
|
* @author Tim Wagner <[email protected]> |
32
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
33
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
34
|
|
|
* @link https://github.com/techdivision/import-cli-simple |
35
|
|
|
* @link http://www.techdivision.com |
36
|
|
|
*/ |
37
|
|
|
class Formatter implements FormatterConfigurationInterface |
38
|
|
|
{ |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* The trait that provides parameter handling functionality. |
42
|
|
|
* |
43
|
|
|
* @var \TechDivision\Import\Cli\Configuration\ParamsTrait |
44
|
|
|
*/ |
45
|
|
|
use ParamsTrait; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* The formatter's type to use. |
49
|
|
|
* |
50
|
|
|
* @var string |
51
|
|
|
* @Type("string") |
52
|
|
|
*/ |
53
|
|
|
protected $type; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Return's the formatter's type to use. |
57
|
|
|
* |
58
|
|
|
* @return string The type |
59
|
|
|
*/ |
60
|
|
|
public function getType() |
61
|
|
|
{ |
62
|
|
|
return $this->type; |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: