aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/3rdparty/libraries/MOBIClass/FileString.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2015-01-19 13:37:32 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2015-01-19 13:37:32 +0100
commit3d99ce9dadca82765832ab669dabc22c554fd78e (patch)
treee47e84483e03ccc289bf5768526dedacdff07add /inc/3rdparty/libraries/MOBIClass/FileString.php
parent99410a21eb261f50234cc4148323a52b345e15e1 (diff)
downloadwallabag-3d99ce9dadca82765832ab669dabc22c554fd78e.tar.gz
wallabag-3d99ce9dadca82765832ab669dabc22c554fd78e.tar.zst
wallabag-3d99ce9dadca82765832ab669dabc22c554fd78e.zip
travis configuration
Diffstat (limited to 'inc/3rdparty/libraries/MOBIClass/FileString.php')
-rw-r--r--inc/3rdparty/libraries/MOBIClass/FileString.php83
1 files changed, 0 insertions, 83 deletions
diff --git a/inc/3rdparty/libraries/MOBIClass/FileString.php b/inc/3rdparty/libraries/MOBIClass/FileString.php
deleted file mode 100644
index 16e906a6..00000000
--- a/inc/3rdparty/libraries/MOBIClass/FileString.php
+++ /dev/null
@@ -1,83 +0,0 @@
1<?php
2
3/**
4 * Description of FileString
5 *
6 * @author Sander
7 */
8class FileString extends FileObject {
9 private $forcedLength;
10 private $data;
11
12 /**
13 * Make a string to be stored in a file
14 * @param string|int $first Optional, if it is a string, it will be the contents,
15 * if it is a number, it will set the forced length.
16 * @param int $second Optional, will set the forced length. Can only be used when the
17 * first argument is contents.
18 */
19 public function __construct($first = null, $second = null){
20 $this->forcedLength = -1;
21 $this->data = "";
22
23 if($second != null){
24 $this->data = $first;
25 $this->forcedLength = $second;
26 }else if($first != null){
27 if(is_string($first)){
28 $this->data = $first;
29 }else{
30 $this->forcedLength = $first;
31 }
32 }
33 }
34
35 public function getByteLength(){
36 return $this->getLength();
37 }
38
39 public function getLength(){
40 if($this->forcedLength >= 0){
41 return $this->forcedLength;
42 }
43 return strlen($this->data);
44 }
45
46 public function get(){
47 return $this->data;
48 }
49
50 public function set($value){
51 $this->data = $value;
52 }
53
54 public function serialize() {
55 $output = $this->data;
56 $curLength = strlen($output);
57
58 if($this->forcedLength >= 0){
59 if($this->forcedLength > $curLength){
60 return str_pad($output, $this->forcedLength, "\0", STR_PAD_RIGHT);
61 }elseif($this->forcedLength == $curLength){
62 return $output;
63 }else{
64 return substr($output, 0, $this->forcedLength);
65 }
66 }
67 return $output;
68 }
69
70 public function unserialize($data) {
71 __construct($data);
72 }
73
74 public function __toString(){
75 $out = "FileString";
76 if($this->forcedLength >= 0){
77 $out .= " ".$this->forcedLength;
78 }
79 $out .= ": {\"".str_replace(array(" ", "\0"), "&nbsp;", $this->serialize())."\"}";
80 return $out;
81 }
82}
83?>