Completed
Pull Request — master (#57)
by Olexandr
02:41
created

Row::createDefinition()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 10
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 10
loc 10
rs 9.4285
cc 1
eloc 7
nc 1
nop 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: nazarenko
5
 * Date: 29.03.2016
6
 * Time: 12:38
7
 */
8
9
namespace samsoncms\api\generator;
10
11
use samsoncms\api\generator\metadata\Virtual;
12
use samsonphp\generator\Generator;
13
14
/**
15
 * Row class generator.
16
 *
17
 * @package samsoncms\api\generator
18
 */
19
class Row extends Entity
20
{
21
    /**
22
     * Query constructor.
23
     *
24
     * @param Generator $generator
25
     * @param           $metadata
26
     */
27
    public function __construct(Generator $generator, $metadata)
28
    {
29
        parent::__construct($generator, $metadata);
30
31
        $this->className = rtrim($this->className, 'Table').'TableRow';
32
    }
33
34
    /**
35
     * Class definition generation part.
36
     *
37
     * @param Virtual $metadata Entity metadata
38
     */
39 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...
40
    {
41
        $this->generator
42
            ->multiComment(array(
43
                'Class for rendering "' . $metadata->entityRealName . '" row',
44
            ))
45
            ->defClass($this->className, '\\'.\samsoncms\api\field\Row::class)
46
            ->newLine('use \\'.\samsoncms\api\Renderable::class.';')
47
            ->newLine();
48
    }
49
}
50