AloWAMP source documentation
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
  • Download

Namespaces

  • None
  • PHP
  • Setup
  • VersionSwitch

Classes

  • cURL
  • Downloader
  • Format
  • Handler
  • IO
  • Router
  • Service
  • Settings
  • Setup

Functions

  • _echo
  • get
 1 <?php
 2 
 3    /**
 4     * Handles input & output
 5     *
 6     * @author Art <a.molcanovas@gmail.com>
 7     */
 8    abstract class IO {
 9 
10       /**
11        * Arguments passed on to PHP excl the first (file name)
12        *
13        * @var array
14        */
15       public static $argv;
16 
17       /**
18        * Clears previous output
19        *
20        * @author Art <a.molcanovas@gmail.com>
21        *
22        * @param int $lines Amount of empty lines to output
23        */
24       static function echo_lines($lines = 100) {
25          $l     = "";
26          $lines = (int)$lines;
27 
28          for($i = 0; $i < $lines; $i++) {
29             $l .= PHP_EOL;
30          }
31 
32          echo $l;
33       }
34 
35       /**
36        * Opens a file
37        *
38        * @author Art <a.molcanovas@gmail.com>
39        *
40        * @param string $path File path
41        */
42       static function open_file($path) {
43          shell_exec('start ' . $path);
44       }
45 
46       /**
47        * Reads a line of user input
48        *
49        * @author Art <a.molcanovas@gmail.com>
50        *
51        * @param string $prompt Prompt message
52        *
53        * @return string
54        */
55       static function readline($prompt = null) {
56          if($prompt) {
57             echo '[' . date('Y-m-d H:i:s') . '] ' . $prompt . ': ';
58          }
59 
60          $r = trim(strtolower(stream_get_line(STDIN, PHP_INT_MAX, PHP_EOL)));
61          echo PHP_EOL;
62 
63          return $r;
64       }
65 
66    }
67 
68    IO::$argv = $_SERVER['argv'];
69    array_shift(IO::$argv);
AloWAMP source documentation API documentation generated byApiGen 2.8.0