Overview

Namespaces

  • Liberty
  • None

Classes

  • Liberty\BigInteger
  • Liberty\Block
  • Liberty\Blockchain
  • Liberty\Collection
  • Liberty\CollectionFileList
  • Liberty\File
  • Liberty\Folder
  • Liberty\INI
  • Liberty\LECDSA
  • Liberty\Onecrypt
  • Liberty\SSV
  • Liberty\Text
  • Liberty\Transaction
  • Liberty\Wallet
  • Liberty\WebPeer

Functions

  • __autoload
  • Overview
  • Namespace
  • Class
 1: <?php
 2: 
 3: namespace Liberty;
 4: 
 5: use Liberty\Collection;
 6: 
 7: /**
 8:  * CollectionFileList class.
 9:  *
10:  * @category  Cryptocurrency
11:  * @package   Liberty
12:  * @license   https://en.wikipedia.org/wiki/Public_domain Public Domain.
13:  * @version   1.0.0
14:  * @since     2018-02-17
15:  * @author    Liberty Group <cryptolibertygroup@gmail.com>
16:  */
17: 
18: 
19: 
20: class CollectionFileList extends Collection {
21: 
22: 
23:     protected $file;
24: 
25: 
26:     public function __construct($list=array())
27:     {
28:         if(isset($list)) {
29:             $this->items = $list;
30:         }
31:     }
32: 
33: 
34: 
35:     public function read($file)
36:     {
37:         if($file == "") {
38:             throw new Exception("File not found.");
39:         }
40: 
41:         $this->file = $file;
42:         $list = file($this->file);
43: 
44:         foreach($list as $key => $value) {
45:             $this->items[$key] = rtrim($value);
46:         }
47: 
48:         return $this->items;
49:     }
50: 
51: 
52: 
53:     public function write($file)
54:     {
55:         if($file == "") {
56:             throw new Exception("File not found.");
57:         }
58: 
59:         $this->file = $file;
60:         $resource = fopen($this->file, "wb");
61:         
62:         foreach($this->items as $key => $value) {
63:             fputs($resource, $value . "\n");
64:         }
65: 
66:         fclose($resource);
67:     }
68: 
69: }
70: 
71: 
72: ?>
73: 
API documentation generated by ApiGen