Cancelled
Push — 2.0 ( c33a68...ef9d4b )
by David
346:33 queued 346:33
created

ZohoDatabaseHelper   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTableName() 0 7 1
A getFlatFields() 0 9 2
1
<?php
2
3
namespace Wabel\Zoho\CRM\Copy;
4
5
use function Stringy\create as s;
6
use Wabel\Zoho\CRM\AbstractZohoDao;
7
8
/**
9
 *  ZohoDatabaseHelper : Helper class.
10
 */
11
class ZohoDatabaseHelper
12
{
13
    /**
14
     * Computes the name of the table based on the DAO plural module name.
15
     *
16
     * @param AbstractZohoDao $dao
17
     *
18
     * @return string
19
     */
20
    public static function getTableName(AbstractZohoDao $dao, $prefix)
21
    {
22
        $tableName = $prefix.$dao->getPluralModuleName();
0 ignored issues
show
Bug introduced by
The method getPluralModuleName() cannot be called from this context as it is declared protected in class Wabel\Zoho\CRM\AbstractZohoDao.

This check looks for access to methods that are not accessible from the current context.

If you need to make a method accessible to another context you can raise its visibility level in the defining class.

Loading history...
23
        $tableName = s($tableName)->upperCamelize()->underscored();
24
25
        return (string) $tableName;
26
    }
27
28
    public static function getFlatFields(array $fields)
29
    {
30
        $flatFields = [];
31
        foreach ($fields as $cat) {
32
            $flatFields = array_merge($flatFields, $cat);
33
        }
34
35
        return $flatFields;
36
    }
37
}
38