Completed
Pull Request — 1.1 (#3)
by Raphaël
02:40
created

ZohoDatabaseHelper   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
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 28
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
 */
12
class ZohoDatabaseHelper
13
{
14
    
15
    /**
16
     * Computes the name of the table based on the DAO plural module name.
17
     *
18
     * @param AbstractZohoDao $dao
19
     *
20
     * @return string
21
     */
22
    public static function getTableName(AbstractZohoDao $dao, $prefix)
23
    {
24
        $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...
25
        $tableName = s($tableName)->upperCamelize()->underscored();
26
27
        return (string) $tableName;
28
    }
29
30
    public static function getFlatFields(array $fields)
31
    {
32
        $flatFields = [];
33
        foreach ($fields as $cat) {
34
            $flatFields = array_merge($flatFields, $cat);
35
        }
36
37
        return $flatFields;
38
    }
39
}