XlsxFileReader::getUploadedFileConstraints()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
3
namespace Pim\Bundle\ExcelConnectorBundle\Reader;
4
5
use Pim\Bundle\CatalogBundle\Validator\Constraints\File as AssertFile;
6
use Symfony\Component\Validator\Constraints as Assert;
7
8
/**
9
 * XLSX file reader
10
 *
11
 * @author    Antoine Guigan <[email protected]>
12
 * @copyright 2013 Akeneo SAS (http://www.akeneo.com)
13
 * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
14
 */
15
class XlsxFileReader extends FileIteratorReader
16
{
17
    /**
18
     * @var string
19
     *
20
     * @Assert\NotBlank(groups={"Execution"})
21
     * @AssertFile(
22
     *     groups={"Execution"},
23
     *     allowedExtensions={"xlsx", "xlsm", "csv"},
24
     * )
25
     */
26
    protected $filePath;
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function getUploadedFileConstraints()
32
    {
33
        return array(
34
            new Assert\NotBlank(),
35
            new AssertFile(
36
                array(
37
                    'allowedExtensions' => array('xlsx', 'xlsm')
38
                )
39
            )
40
        );
41
    }
42
}
43