ExtendedI18nBehavior   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 5
Bugs 0 Features 3
Metric Value
wmc 4
c 5
b 0
f 3
lcom 1
cbo 2
dl 0
loc 29
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A modifyTable() 0 13 3
A objectMethods() 0 9 1
1
<?php
2
3
namespace ItBlaster\TranslationBundle\Behavior;
4
5
class ExtendedI18nBehavior extends TranslationBehavior
6
{
7
    /**
8
     * Add the slug_column to the current table
9
     */
10
    public function modifyTable()
11
    {
12
        $table = $this->getTable();
13
        $primary_string = $this->getParameter('primary_string');
14
15
        if(!$primary_string) {
16
            $this->exceptionError('Need set parameter "primary_string" in table '.$table->getName());
17
        }
18
19
        if(!$table->hasColumn($primary_string)) {
20
            $this->exceptionError('Not found column "'.$primary_string.'" in table '.$table->getName());
21
        }
22
    }
23
24
    public function objectMethods(\PHP5ObjectBuilder $builder)
25
    {
26
        $this->builder = $builder;
0 ignored issues
show
Bug introduced by
The property builder does not seem to exist. Did you mean additionalBuilders?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
27
        $script = '';
28
29
        $this->addSortI18ns($script);
30
31
        return $script;
32
    }
33
}