Completed
Push — id3-metadata-objects ( ee91c4...501882 )
by Daniel
03:30
created

FrameWriter::setName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 0
cts 3
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * This file is part of the Metadata package.
4
 *
5
 * @author Daniel Schröder <[email protected]>
6
 */
7
8
namespace GravityMedia\Metadata\ID3v2\Writer;
9
10
use GravityMedia\Metadata\ID3v2\StreamContainer;
11
12
/**
13
 * ID3v2 frame writer class.
14
 *
15
 * @package GravityMedia\Metadata\ID3v2\Writer
16
 */
17
class FrameWriter extends StreamContainer
18
{
19
    /**
20
     * @var string
21
     */
22
    private $name;
23
24
    /**
25
     * Set ID3v2 frame name.
26
     *
27
     * @param string $name
28
     *
29
     * @return $this
30
     */
31
    public function setName($name)
32
    {
33
        $this->name = $name;
34
35
        return $this;
36
    }
37
38
    /**
39
     * Write ID3v2 frame data data.
40
     *
41
     * @return $this
42
     */
43
    public function write()
44
    {
45
        $this->getStream()->seek($this->getOffset());
46
47
        $this->getStream()->write($this->name);
48
49
        return $this;
50
    }
51
}
52