ProductFamilyExcelBuilder::getWorksheetName()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
1
<?php
2
3
namespace Pim\Bundle\ExcelConnectorBundle\Excel\Builder;
4
5
use PHPExcel_Shared_String;
6
7
/**
8
 * Excel builder for products, with one tab per family
9
 *
10
 * @author    Antoine Guigan <[email protected]>
11
 * @copyright 2013 Akeneo SAS (http://www.akeneo.com)
12
 * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
13
 */
14
class ProductFamilyExcelBuilder extends AbstractExcelBuilder
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    protected function getWorksheetName(array $data)
20
    {
21
        $worksheetName = $data['family'];
22
        if (PHPExcel_Shared_String::CountCharacters($worksheetName) > 31) {
23
            $worksheetName = PHPExcel_Shared_String::Substring($worksheetName, 0, 31);
24
        }
25
        return $worksheetName;
26
    }
27
}
28