Row::createDefinition()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 11
Ratio 100 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 11
loc 11
rs 9.4285
cc 1
eloc 8
nc 1
nop 1
1
<?php
2
//[PHPCOMPRESSOR(remove,start)]
3
/**
4
 * Created by PhpStorm.
5
 * User: nazarenko
6
 * Date: 29.03.2016
7
 * Time: 12:38
8
 */
9
10
namespace samsoncms\api\generator;
11
12
use samsoncms\api\generator\metadata\VirtualMetadata;
13
use samsonphp\generator\Generator;
14
15
/**
16
 * Row class generator.
17
 *
18
 * @package samsoncms\api\generator
19
 * @deprecated
20
 */
21
class Row extends VirtualEntity
22
{
23
    /**
24
     * Query constructor.
25
     *
26
     * @param Generator $generator
27
     * @param           $metadata
28
     */
29
    public function __construct(Generator $generator, $metadata)
30
    {
31
        parent::__construct($generator, $metadata);
32
33
        $this->className = preg_replace('/Table$/i', '', $this->className) . 'TableRow';
34
    }
35
36
    /**
37
     * Class definition generation part.
38
     *
39
     * @param VirtualMetadata $metadata Entity metadata
40
     */
41 View Code Duplication
    protected function createDefinition($metadata)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
42
    {
43
        $this->generator
44
            ->multiComment(array(
45
                'Class for rendering "' . $metadata->entityRealName . '" row',
46
                '@deprecated Use ' . $this->className . 'Entity instead'
47
            ))
48
            ->defClass($this->className, '\\'.\samsoncms\api\field\Row::class)
49
            ->newLine('use \\'.\samsoncms\api\Renderable::class.';')
50
            ->newLine();
51
    }
52
}
53
//[PHPCOMPRESSOR(remove,end)]
54