FileExtension   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildSchema() 0 6 1
A getName() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Psi\Component\Description\Schema\Extension;
6
7
use Psi\Component\Description\Schema\ExtensionInterface;
8
use Psi\Component\Description\Schema\Builder;
9
use Psi\Component\Description\Descriptor\IntegerDescriptor;
10
use Psi\Component\Description\Descriptor\StringDescriptor;
11
12
/**
13
 * Standard descriptors for files.
14
 */
15
class FileExtension implements ExtensionInterface
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function buildSchema(Builder $builder)
21
    {
22
        $builder->add('mime-type', StringDescriptor::class, 'Mime-type of the file');
23
        $builder->add('size', IntegerDescriptor::class, 'Size of the file in bytes');
24
        $builder->add('encoding', StringDescriptor::class, 'Encoding of the file');
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function getName()
31
    {
32
        return 'file';
33
    }
34
}
35