aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/3rdparty/libraries/MOBIClass/FileShort.php
blob: 9921ea82501ee2b908df082ece4ac266f82b847c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php

/**
 * Description of FileShort
 *
 * @author Sander
 */
class FileShort extends FileObject {
	private $data;

	/**
	 * Make a short to be stored in a file
	 * @param short $n
	 */
	public function __construct($n = 0){
		parent::__construct(2);
		$this->set($n);
	}

	public function get(){
		return $this->data;
	}

	public function set($value){
		$this->data = intval($value) & 0xFFFF;
	}

	public function serialize() {
		return $this->shortToString($this->data);
	}

	public function unserialize($data) {
		__construct($this->toInt($data));
	}


	public function __toString(){
		return "FileShort: {".$this->shortAsString($this->data)."}";
	}
}
?>