MappedProperty::create()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 9.6667
cc 2
eloc 5
nc 2
nop 3
1
<?php
2
/**
3
 * Author: Nil Portugués Calderó <[email protected]>
4
 * Date: 12/17/15
5
 * Time: 11:41 PM.
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace NilPortugues\SchemaOrg;
12
13
/**
14
 * Class MappedProperty.
15
 */
16
class MappedProperty
17
{
18
    /**
19
     * @var array
20
     */
21
    private static $instances = [];
22
23
    /**
24
     * @param string $schemaClass
25
     * @param string $propertyName
26
     * @param string $propertyUrl
27
     *
28
     * @return Mapping
29
     */
30
    public static function create($schemaClass, $propertyName, $propertyUrl)
31
    {
32
        $key = md5(implode('.', func_get_args()));
33
        if (empty(self::$instances[$key])) {
34
            self::$instances[$key] = new Mapping($schemaClass, $propertyName, $propertyUrl);
35
        }
36
37
        return self::$instances[$key];
38
    }
39
}
40