Test Failed
Push — develop ( 90366f...812a46 )
by Adrien
28:16
created

File::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace PhpOffice\PhpSpreadsheet\Shared\OLE\PPS;
4
5
// vim: set expandtab tabstop=4 shiftwidth=4:
6
// +----------------------------------------------------------------------+
7
// | PHP Version 4                                                        |
8
// +----------------------------------------------------------------------+
9
// | Copyright (c) 1997-2002 The PHP Group                                |
10
// +----------------------------------------------------------------------+
11
// | This source file is subject to version 2.02 of the PHP license,      |
12
// | that is bundled with this package in the file LICENSE, and is        |
13
// | available at through the world-wide-web at                           |
14
// | http://www.php.net/license/2_02.txt.                                 |
15
// | If you did not receive a copy of the PHP license and are unable to   |
16
// | obtain it through the world-wide-web, please send a note to          |
17
// | [email protected] so we can mail you a copy immediately.               |
18
// +----------------------------------------------------------------------+
19
// | Author: Xavier Noguer <[email protected]>                              |
20
// | Based on OLE::Storage_Lite by Kawai, Takanori                        |
21
// +----------------------------------------------------------------------+
22
//
23
use PhpOffice\PhpSpreadsheet\Shared\OLE;
24
use PhpOffice\PhpSpreadsheet\Shared\OLE\PPS;
25
26
/**
27
 * Class for creating File PPS's for OLE containers.
28
 *
29
 * @author   Xavier Noguer <[email protected]>
30
 *
31
 * @category PhpSpreadsheet
32
 */
33
class File extends PPS
34
{
35
    /**
36
     * The constructor.
37
     *
38
     * @param string $name The name of the file (in Unicode)
39
     *
40
     * @see OLE::ascToUcs()
41
     */
42 39
    public function __construct($name)
43
    {
44 39
        parent::__construct(null, $name, OLE::OLE_PPS_TYPE_FILE, null, null, null, null, null, '', []);
45 39
    }
46
47
    /**
48
     * Initialization method. Has to be called right after OLE_PPS_File().
49
     *
50
     * @return mixed true on success
51
     */
52
    public function init()
53
    {
54
        return true;
55
    }
56
57
    /**
58
     * Append data to PPS.
59
     *
60
     * @param string $data The data to append
61
     */
62 39
    public function append($data)
63
    {
64 39
        $this->_data .= $data;
65 39
    }
66
67
    /**
68
     * Returns a stream for reading this file using fread() etc.
69
     *
70
     * @return resource a read-only stream
71
     */
72
    public function getStream()
73
    {
74
        $this->ole->getStream($this);
75
    }
76
}
77