Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added Pinocchio-generated annotated source.

  • Loading branch information...
commit c99d894598a6e7462f4c1fdd2e4a31c131918ddd 1 parent a4edbe9
@ncuesta authored
View
397 doc/Clinner/Command/Callback.html
@@ -1,397 +0,0 @@
-<!DOCTYPE html>
-
-<html>
-<head>
- <title>Callback.php</title>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <link rel="stylesheet" media="all" href="layout.css" />
- <style>
- /*--------------------- Layout and Typography ----------------------------*/
-body { font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; font-size: 15px; line-height: 22px; color: #252519; margin: 0; padding: 0;
-}
-a { color: #261a3b;
-} a:visited { color: #261a3b; }
-p { margin: 0 0 15px 0;
-}
-h1, h2, h3, h4, h5, h6 { margin: 40px 0 15px 0;
-} h3, h4, h5, h6 { margin-top: 20px; }
-#container { position: relative;
-}
-#background { position: fixed; top: 0; left: 575px; right: 0; bottom: 0; background: #f5f5ff; border-left: 1px solid #e5e5ee; z-index: -1;
-}
-#jump_to, #jump_page { background: white; -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; font: 10px Arial; text-transform: uppercase; cursor: pointer; text-align: right;
-}
-#jump_to, #jump_wrapper { position: fixed; right: 0; top: 0; padding: 5px 10px;
-} #jump_wrapper { padding: 0; display: none; } #jump_to:hover #jump_wrapper { display: block; } #jump_page { padding: 5px 0 3px; margin: 0 0 25px 25px; overflow:hidden; } #jump_page .source { display: block; padding: 5px 10px; text-decoration: none; border-top: 1px solid #eee; float:left; min-width:180px; text-align:left; text-transform:none; font-size:11px; } #jump_page .source:hover { background: #f5f5ff; } #jump_page .source:first-child { }
-table td { border: 0; outline: 0;
-} td.docs, th.docs { max-width: 450px; min-width: 450px; min-height: 5px; padding: 10px 25px 1px 50px; overflow-x: hidden; vertical-align: top; text-align: left; } .docs pre { margin: 15px 0 15px; padding-left: 15px; } .docs p tt, .docs p code { background: #f8f8ff; border: 1px solid #dedede; font-size: 12px; padding: 0 0.2em; } .pilwrap { position: relative; } .pilcrow { font: 12px Arial; text-decoration: none; color: #454545; position: absolute; top: 3px; left: -20px; padding: 1px 2px; opacity: 0; -webkit-transition: opacity 0.2s linear; } td.docs:hover .pilcrow { opacity: 1; } td.code, th.code { padding: 14px 15px 16px 25px; width: 100%; vertical-align: top; background: #f5f5ff; border-left: 1px solid #e5e5ee; } pre, tt, code { font-size: 12px; line-height: 18px; font-family: Monaco, Consolas, "Lucida Console", monospace; margin: 0; padding: 0; } /*---------------------- Syntax Highlighting -----------------------------*/
-td.linenos { background-color: #f0f0f0; padding-right: 10px; }
-span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
-body .hll { background-color: #ffffcc }
-body .c { color: #408080; font-style: italic } /* Comment */
-body .err { border: 1px solid #FF0000 } /* Error */
-body .k { color: #954121 } /* Keyword */
-body .o { color: #666666 } /* Operator */
-body .cm { color: #408080; font-style: italic } /* Comment.Multiline */
-body .cp { color: #BC7A00 } /* Comment.Preproc */
-body .c1 { color: #408080; font-style: italic } /* Comment.Single */
-body .cs { color: #408080; font-style: italic } /* Comment.Special */
-body .gd { color: #A00000 } /* Generic.Deleted */
-body .ge { font-style: italic } /* Generic.Emph */
-body .gr { color: #FF0000 } /* Generic.Error */
-body .gh { color: #000080; font-weight: bold } /* Generic.Heading */
-body .gi { color: #00A000 } /* Generic.Inserted */
-body .go { color: #808080 } /* Generic.Output */
-body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
-body .gs { font-weight: bold } /* Generic.Strong */
-body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
-body .gt { color: #0040D0 } /* Generic.Traceback */
-body .kc { color: #954121 } /* Keyword.Constant */
-body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */
-body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */
-body .kp { color: #954121 } /* Keyword.Pseudo */
-body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */
-body .kt { color: #B00040 } /* Keyword.Type */
-body .m { color: #666666 } /* Literal.Number */
-body .s { color: #219161 } /* Literal.String */
-body .na { color: #7D9029 } /* Name.Attribute */
-body .nb { color: #954121 } /* Name.Builtin */
-body .nc { color: #0000FF; font-weight: bold } /* Name.Class */
-body .no { color: #880000 } /* Name.Constant */
-body .nd { color: #AA22FF } /* Name.Decorator */
-body .ni { color: #999999; font-weight: bold } /* Name.Entity */
-body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
-body .nf { color: #0000FF } /* Name.Function */
-body .nl { color: #A0A000 } /* Name.Label */
-body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
-body .nt { color: #954121; font-weight: bold } /* Name.Tag */
-body .nv { color: #19469D } /* Name.Variable */
-body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
-body .w { color: #bbbbbb } /* Text.Whitespace */
-body .mf { color: #666666 } /* Literal.Number.Float */
-body .mh { color: #666666 } /* Literal.Number.Hex */
-body .mi { color: #666666 } /* Literal.Number.Integer */
-body .mo { color: #666666 } /* Literal.Number.Oct */
-body .sb { color: #219161 } /* Literal.String.Backtick */
-body .sc { color: #219161 } /* Literal.String.Char */
-body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */
-body .s2 { color: #219161 } /* Literal.String.Double */
-body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
-body .sh { color: #219161 } /* Literal.String.Heredoc */
-body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
-body .sx { color: #954121 } /* Literal.String.Other */
-body .sr { color: #BB6688 } /* Literal.String.Regex */
-body .s1 { color: #219161 } /* Literal.String.Single */
-body .ss { color: #19469D } /* Literal.String.Symbol */
-body .bp { color: #954121 } /* Name.Builtin.Pseudo */
-body .vc { color: #19469D } /* Name.Variable.Class */
-body .vg { color: #19469D } /* Name.Variable.Global */
-body .vi { color: #19469D } /* Name.Variable.Instance */
-body .il { color: #666666 } /* Literal.Number.Integer.Long */ /********** PHP Comment Additions ********/
-td.docs .docparam {color:#DB251A;font-weight:bold;}
- </style>
-</head>
-<body>
- <div id="container">
- <div id="background"></div>
- <div id="jump_to">
- Jump To &hellip;
- <div id="jump_wrapper">
- <div id="jump_page">
- <a class="source" href="../../Clinner/Command/Callback.html">
- Callback.php </a>
- <a class="source" href="../../Clinner/Command/Command.html">
- Command.php </a>
- <a class="source" href="../../Clinner/Command/CommandInterface.html">
- CommandInterface.php </a>
- <a class="source" href="../../Clinner/Command/NullCommand.html">
- NullCommand.php </a>
- <a class="source" href="../../Clinner/Command/PipeableCommandInterface.html">
- PipeableCommandInterface.php </a>
- <a class="source" href="../../Clinner/Command/PipingCommandInterface.html">
- PipingCommandInterface.php </a>
- <a class="source" href="../../Clinner/ValueHolder.html">
- ValueHolder.php </a>
- </div>
- </div>
- </div>
- <table cellpadding="0" cellspacing="0">
- <thead>
- <tr>
- <th class="docs">
- <h1>
- Callback.php </h1>
- </th>
- <th class="code">
- </th>
- </tr>
- </thead>
- <tbody>
- <tr id="section-0">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-0">&#182;</a>
- </div>
- <p>This file is part of the Clinner library.</p>
-
-<p>(c) José Nahuel Cuesta Luengo <a href="&#x6d;&#x61;&#105;&#108;&#116;&#x6f;&#x3a;&#x6e;&#97;&#104;u&#x65;&#x6c;&#99;&#117;&#101;&#x73;&#x74;&#x61;&#108;&#117;e&#x6e;&#x67;&#111;&#64;&#103;&#x6d;&#x61;&#x69;&#108;&#46;c&#x6f;&#x6d;">&#x6e;&#97;&#104;u&#x65;&#x6c;&#99;&#117;&#101;&#x73;&#x74;&#x61;&#108;&#117;e&#x6e;&#x67;&#111;&#64;&#103;&#x6d;&#x61;&#x69;&#108;&#46;c&#x6f;&#x6d;</a></p>
-
-<p>For the full copyright and license information, please view the LICENSE
- file that was distributed with this source code.</p>
- </td>
- <td class="code">
- <div class="highlight"><pre><span class="k">namespace</span> <span class="nx">Clinner\Command</span><span class="p">;</span></pre></div> </td>
- </tr>
- <tr id="section-1">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-1">&#182;</a>
- </div>
- <p>Callback class.
- This is a command abstraction which actually delegates the execution logic
- to a callback function.
- The function will be invoked with an input string argument, and is expected
- to return an integer value representing the exit code for the command:</p>
-
-<p><code>
- <em class='docparam'>@param</em> string|null $input The input for the string.
- <em class='docparam'>@return</em> int The exit code for the command.
- function callback(string $input);
- </code></p>
-
-<p>Any output generated to stdout will be buffered as the command's output.</p>
-
-<p>Usage examples:</p>
-
-<p><code>
- Get all the users in the system whose username contains at least one 'a'
- $systemUsers = Command::create('cat', array('/etc/passwd'))
- ->pipe(
- Command::create('grep', array('-v' => '^#'), array('delimiter' => ' '))
- )
- ->pipe(
- Command::create('cut', array('-d' => ':', '-f' => 1), array('delimiter' => ''))
- )
- ->pipe($callbackCommand)
- ->run()
- ->getOutputAsArray("\n");
- </code></p>
-
-<p><em class='docparam'>@author</em> José Nahuel Cuesta Luengo <a href="&#x6d;&#x61;&#105;&#108;&#116;&#x6f;&#x3a;&#x6e;&#97;&#104;u&#x65;&#x6c;&#99;&#117;&#101;&#x73;&#x74;&#x61;&#108;&#117;e&#x6e;&#x67;&#111;&#64;&#103;&#x6d;&#x61;&#x69;&#108;&#46;c&#x6f;&#x6d;">&#x6e;&#97;&#104;u&#x65;&#x6c;&#99;&#117;&#101;&#x73;&#x74;&#x61;&#108;&#117;e&#x6e;&#x67;&#111;&#64;&#103;&#x6d;&#x61;&#x69;&#108;&#46;c&#x6f;&#x6d;</a></p>
- </td>
- <td class="code">
- <div class="highlight"><pre><span class="k">class</span> <span class="nc">Callback</span> <span class="k">implements</span> <span class="nx">CommandInterface</span><span class="p">,</span> <span class="nx">PipeableCommandInterface</span>
-<span class="p">{</span></pre></div> </td>
- </tr>
- <tr id="section-2">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-2">&#182;</a>
- </div>
- <p>Exit code for this command.</p>
-
-<p><em class='docparam'>@var</em> int</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">private</span> <span class="nv">$_exitCode</span><span class="p">;</span></pre></div> </td>
- </tr>
- <tr id="section-3">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-3">&#182;</a>
- </div>
- <p>Output for this command.</p>
-
-<p><em class='docparam'>@var</em> string</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">private</span> <span class="nv">$_output</span><span class="p">;</span></pre></div> </td>
- </tr>
- <tr id="section-4">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-4">&#182;</a>
- </div>
- <p>Callback function/method that will be invoked when command is run.</p>
-
-<p><em class='docparam'>@var</em> \Closure</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">private</span> <span class="nv">$_callback</span><span class="p">;</span></pre></div> </td>
- </tr>
- <tr id="section-5">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-5">&#182;</a>
- </div>
- <p>Constructor.</p>
-
-<p><em class='docparam'>@param</em> \Closure $callback The callback function.</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">__construct</span><span class="p">(</span><span class="nv">$callback</span><span class="p">)</span>
- <span class="p">{</span>
- <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">setCallback</span><span class="p">(</span><span class="nv">$callback</span><span class="p">);</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-6">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-6">&#182;</a>
- </div>
- <p>Get the callback function for this command.</p>
-
-<p><em class='docparam'>@return</em> \Closure</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">getCallback</span><span class="p">()</span>
- <span class="p">{</span>
- <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_callback</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-7">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-7">&#182;</a>
- </div>
- <p>Set the callback function for this command.</p>
-
-<p><em class='docparam'>@param</em> \Closure $callback The callback function.</p>
-
-<p><em class='docparam'>@return</em> \Clinner\Command\Callback This instance, for a fluent API.</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">setCallback</span><span class="p">(</span><span class="nv">$callback</span><span class="p">)</span>
- <span class="p">{</span>
- <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_callback</span> <span class="o">=</span> <span class="nv">$callback</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-8">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-8">&#182;</a>
- </div>
- <p>Run this command and get the exit code for it.</p>
-
-<p><em class='docparam'>@param</em> string $input (Optional) input string for this command.</p>
-
-<p><em class='docparam'>@return</em> \Clinner\Command\CommandInterface This command, for a fluent API.</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">run</span><span class="p">(</span><span class="nv">$input</span> <span class="o">=</span> <span class="k">null</span><span class="p">)</span>
- <span class="p">{</span>
- <span class="nv">$callback</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getCallback</span><span class="p">();</span>
-
- <span class="nb">ob_start</span><span class="p">();</span>
-
- <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_exitCode</span> <span class="o">=</span> <span class="nv">$callback</span><span class="p">(</span><span class="nv">$input</span><span class="p">);</span>
-
- <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_output</span> <span class="o">=</span> <span class="nb">ob_get_contents</span><span class="p">();</span>
-
- <span class="nb">ob_end_clean</span><span class="p">();</span>
-
- <span class="k">return</span> <span class="nv">$this</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-9">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-9">&#182;</a>
- </div>
- <p>Get the exit code for this command's execution.
- This method will only return a valid value after the command has been executed.</p>
-
-<p><em class='docparam'>@return</em> int</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">getExitCode</span><span class="p">()</span>
- <span class="p">{</span>
- <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_exitCode</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-10">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-10">&#182;</a>
- </div>
- <p>Get the output for this command's execution.
- This method will only return a valid value after the command has been executed.</p>
-
-<p><em class='docparam'>@return</em> string</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">getOutput</span><span class="p">()</span>
- <span class="p">{</span>
- <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_output</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-11">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-11">&#182;</a>
- </div>
- <p>Get the code of the inner callback as string.</p>
-
-<p><em class='docparam'>@return</em> string</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">getCallbackCode</span><span class="p">()</span>
- <span class="p">{</span>
- <span class="nv">$reflection</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">\ReflectionFunction</span><span class="p">(</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_callback</span><span class="p">);</span></pre></div> </td>
- </tr>
- <tr id="section-12">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-12">&#182;</a>
- </div>
- <p>Open file and seek to the first line of the closure</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="nv">$file</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">\SplFileObject</span><span class="p">(</span><span class="nv">$reflection</span><span class="o">-&gt;</span><span class="na">getFileName</span><span class="p">());</span>
- <span class="nv">$file</span><span class="o">-&gt;</span><span class="na">seek</span><span class="p">(</span><span class="nv">$reflection</span><span class="o">-&gt;</span><span class="na">getStartLine</span><span class="p">()</span> <span class="o">-</span> <span class="mi">1</span><span class="p">);</span></pre></div> </td>
- </tr>
- <tr id="section-13">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-13">&#182;</a>
- </div>
- <p>Retrieve all of the lines that contain code for the closure</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="nv">$code</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span><span class="p">;</span>
- <span class="k">while</span> <span class="p">(</span><span class="nv">$file</span><span class="o">-&gt;</span><span class="na">key</span><span class="p">()</span> <span class="o">&lt;</span> <span class="nv">$reflection</span><span class="o">-&gt;</span><span class="na">getEndLine</span><span class="p">())</span>
- <span class="p">{</span>
- <span class="nv">$code</span> <span class="o">.=</span> <span class="nv">$file</span><span class="o">-&gt;</span><span class="na">current</span><span class="p">();</span>
- <span class="nv">$file</span><span class="o">-&gt;</span><span class="na">next</span><span class="p">();</span>
- <span class="p">}</span>
-
- <span class="nv">$begin</span> <span class="o">=</span> <span class="nb">strpos</span><span class="p">(</span><span class="nv">$code</span><span class="p">,</span> <span class="s1">&#39;function&#39;</span><span class="p">);</span>
- <span class="nv">$end</span> <span class="o">=</span> <span class="nb">strrpos</span><span class="p">(</span><span class="nv">$code</span><span class="p">,</span> <span class="s1">&#39;}&#39;</span><span class="p">);</span>
- <span class="nv">$code</span> <span class="o">=</span> <span class="nx">substr</span><span class="p">(</span><span class="nv">$code</span><span class="p">,</span> <span class="nv">$begin</span><span class="p">,</span> <span class="nv">$end</span> <span class="o">-</span> <span class="nv">$begin</span> <span class="o">+</span> <span class="mi">1</span><span class="p">);</span>
-
- <span class="k">return</span> <span class="nv">$code</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-14">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-14">&#182;</a>
- </div>
- <p>Get a string representation of this command with its arguments,
- as if it would be written in a command-line interface when run.</p>
-
-<p><em class='docparam'>@return</em> string</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">toCommandString</span><span class="p">()</span>
- <span class="p">{</span>
- <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getCallbackCode</span><span class="p">();</span>
- <span class="p">}</span>
-<span class="p">}</span>
-</pre></div></pre></div> </td>
- </tr>
- </tbody>
- </table>
- </div>
-</body>
-</html>
View
838 doc/Clinner/Command/Command.html
@@ -1,838 +0,0 @@
-<!DOCTYPE html>
-
-<html>
-<head>
- <title>Command.php</title>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <link rel="stylesheet" media="all" href="layout.css" />
- <style>
- /*--------------------- Layout and Typography ----------------------------*/
-body { font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; font-size: 15px; line-height: 22px; color: #252519; margin: 0; padding: 0;
-}
-a { color: #261a3b;
-} a:visited { color: #261a3b; }
-p { margin: 0 0 15px 0;
-}
-h1, h2, h3, h4, h5, h6 { margin: 40px 0 15px 0;
-} h3, h4, h5, h6 { margin-top: 20px; }
-#container { position: relative;
-}
-#background { position: fixed; top: 0; left: 575px; right: 0; bottom: 0; background: #f5f5ff; border-left: 1px solid #e5e5ee; z-index: -1;
-}
-#jump_to, #jump_page { background: white; -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; font: 10px Arial; text-transform: uppercase; cursor: pointer; text-align: right;
-}
-#jump_to, #jump_wrapper { position: fixed; right: 0; top: 0; padding: 5px 10px;
-} #jump_wrapper { padding: 0; display: none; } #jump_to:hover #jump_wrapper { display: block; } #jump_page { padding: 5px 0 3px; margin: 0 0 25px 25px; overflow:hidden; } #jump_page .source { display: block; padding: 5px 10px; text-decoration: none; border-top: 1px solid #eee; float:left; min-width:180px; text-align:left; text-transform:none; font-size:11px; } #jump_page .source:hover { background: #f5f5ff; } #jump_page .source:first-child { }
-table td { border: 0; outline: 0;
-} td.docs, th.docs { max-width: 450px; min-width: 450px; min-height: 5px; padding: 10px 25px 1px 50px; overflow-x: hidden; vertical-align: top; text-align: left; } .docs pre { margin: 15px 0 15px; padding-left: 15px; } .docs p tt, .docs p code { background: #f8f8ff; border: 1px solid #dedede; font-size: 12px; padding: 0 0.2em; } .pilwrap { position: relative; } .pilcrow { font: 12px Arial; text-decoration: none; color: #454545; position: absolute; top: 3px; left: -20px; padding: 1px 2px; opacity: 0; -webkit-transition: opacity 0.2s linear; } td.docs:hover .pilcrow { opacity: 1; } td.code, th.code { padding: 14px 15px 16px 25px; width: 100%; vertical-align: top; background: #f5f5ff; border-left: 1px solid #e5e5ee; } pre, tt, code { font-size: 12px; line-height: 18px; font-family: Monaco, Consolas, "Lucida Console", monospace; margin: 0; padding: 0; } /*---------------------- Syntax Highlighting -----------------------------*/
-td.linenos { background-color: #f0f0f0; padding-right: 10px; }
-span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
-body .hll { background-color: #ffffcc }
-body .c { color: #408080; font-style: italic } /* Comment */
-body .err { border: 1px solid #FF0000 } /* Error */
-body .k { color: #954121 } /* Keyword */
-body .o { color: #666666 } /* Operator */
-body .cm { color: #408080; font-style: italic } /* Comment.Multiline */
-body .cp { color: #BC7A00 } /* Comment.Preproc */
-body .c1 { color: #408080; font-style: italic } /* Comment.Single */
-body .cs { color: #408080; font-style: italic } /* Comment.Special */
-body .gd { color: #A00000 } /* Generic.Deleted */
-body .ge { font-style: italic } /* Generic.Emph */
-body .gr { color: #FF0000 } /* Generic.Error */
-body .gh { color: #000080; font-weight: bold } /* Generic.Heading */
-body .gi { color: #00A000 } /* Generic.Inserted */
-body .go { color: #808080 } /* Generic.Output */
-body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
-body .gs { font-weight: bold } /* Generic.Strong */
-body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
-body .gt { color: #0040D0 } /* Generic.Traceback */
-body .kc { color: #954121 } /* Keyword.Constant */
-body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */
-body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */
-body .kp { color: #954121 } /* Keyword.Pseudo */
-body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */
-body .kt { color: #B00040 } /* Keyword.Type */
-body .m { color: #666666 } /* Literal.Number */
-body .s { color: #219161 } /* Literal.String */
-body .na { color: #7D9029 } /* Name.Attribute */
-body .nb { color: #954121 } /* Name.Builtin */
-body .nc { color: #0000FF; font-weight: bold } /* Name.Class */
-body .no { color: #880000 } /* Name.Constant */
-body .nd { color: #AA22FF } /* Name.Decorator */
-body .ni { color: #999999; font-weight: bold } /* Name.Entity */
-body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
-body .nf { color: #0000FF } /* Name.Function */
-body .nl { color: #A0A000 } /* Name.Label */
-body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
-body .nt { color: #954121; font-weight: bold } /* Name.Tag */
-body .nv { color: #19469D } /* Name.Variable */
-body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
-body .w { color: #bbbbbb } /* Text.Whitespace */
-body .mf { color: #666666 } /* Literal.Number.Float */
-body .mh { color: #666666 } /* Literal.Number.Hex */
-body .mi { color: #666666 } /* Literal.Number.Integer */
-body .mo { color: #666666 } /* Literal.Number.Oct */
-body .sb { color: #219161 } /* Literal.String.Backtick */
-body .sc { color: #219161 } /* Literal.String.Char */
-body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */
-body .s2 { color: #219161 } /* Literal.String.Double */
-body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
-body .sh { color: #219161 } /* Literal.String.Heredoc */
-body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
-body .sx { color: #954121 } /* Literal.String.Other */
-body .sr { color: #BB6688 } /* Literal.String.Regex */
-body .s1 { color: #219161 } /* Literal.String.Single */
-body .ss { color: #19469D } /* Literal.String.Symbol */
-body .bp { color: #954121 } /* Name.Builtin.Pseudo */
-body .vc { color: #19469D } /* Name.Variable.Class */
-body .vg { color: #19469D } /* Name.Variable.Global */
-body .vi { color: #19469D } /* Name.Variable.Instance */
-body .il { color: #666666 } /* Literal.Number.Integer.Long */ /********** PHP Comment Additions ********/
-td.docs .docparam {color:#DB251A;font-weight:bold;}
- </style>
-</head>
-<body>
- <div id="container">
- <div id="background"></div>
- <div id="jump_to">
- Jump To &hellip;
- <div id="jump_wrapper">
- <div id="jump_page">
- <a class="source" href="../../Clinner/Command/Callback.html">
- Callback.php </a>
- <a class="source" href="../../Clinner/Command/Command.html">
- Command.php </a>
- <a class="source" href="../../Clinner/Command/CommandInterface.html">
- CommandInterface.php </a>
- <a class="source" href="../../Clinner/Command/NullCommand.html">
- NullCommand.php </a>
- <a class="source" href="../../Clinner/Command/PipeableCommandInterface.html">
- PipeableCommandInterface.php </a>
- <a class="source" href="../../Clinner/Command/PipingCommandInterface.html">
- PipingCommandInterface.php </a>
- <a class="source" href="../../Clinner/ValueHolder.html">
- ValueHolder.php </a>
- </div>
- </div>
- </div>
- <table cellpadding="0" cellspacing="0">
- <thead>
- <tr>
- <th class="docs">
- <h1>
- Command.php </h1>
- </th>
- <th class="code">
- </th>
- </tr>
- </thead>
- <tbody>
- <tr id="section-0">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-0">&#182;</a>
- </div>
- <p>This file is part of the Clinner library.</p>
-
-<p>(c) José Nahuel Cuesta Luengo <a href="&#x6d;&#x61;&#105;&#108;&#116;&#x6f;&#x3a;&#x6e;&#97;&#104;u&#x65;&#x6c;&#99;&#117;&#101;&#x73;&#x74;&#x61;&#108;&#117;e&#x6e;&#x67;&#111;&#64;&#103;&#x6d;&#x61;&#x69;&#108;&#46;c&#x6f;&#x6d;">&#x6e;&#97;&#104;u&#x65;&#x6c;&#99;&#117;&#101;&#x73;&#x74;&#x61;&#108;&#117;e&#x6e;&#x67;&#111;&#64;&#103;&#x6d;&#x61;&#x69;&#108;&#46;c&#x6f;&#x6d;</a></p>
-
-<p>For the full copyright and license information, please view the LICENSE
- file that was distributed with this source code.</p>
- </td>
- <td class="code">
- <div class="highlight"><pre><span class="k">namespace</span> <span class="nx">Clinner\Command</span><span class="p">;</span>
-
-<span class="k">use</span> <span class="nx">Clinner\ValueHolder</span><span class="p">;</span></pre></div> </td>
- </tr>
- <tr id="section-1">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-1">&#182;</a>
- </div>
- <p>Command class.
- Command abstraction class that allows running any command with a given set of arguments.</p>
-
-<p>Usage examples:</p>
-
-<pre><code> Run `ls -l -a` in the current directory
- $command = new \Clinner\Command\Command(
- 'ls',
- array('-l', '-a')
- );
- $command-&gt;run();
- echo $command-&gt;getExitCode();
- echo $command-&gt;getOutput();
-
- This example is equivalent to the one above
- $command = \Clinner\Command\Command::create(
- 'ls',
- array('-l', '-a')
- )
- -&gt;run();
- echo $command-&gt;getExitCode();
- echo $command-&gt;getOutput();
-</code></pre>
-
-<p>You can also pipe commands, just like in a command-line interface:</p>
-
-<pre><code> use \Clinner\Command\Command;
-
- $grepCommand = Command::create(
- 'grep',
- array('-v' =&gt; '^#'),
- array('delimiter' =&gt; ' ')
- );
- $cutCommand = Command::create(
- 'cut',
- array('-d' =&gt; ':', '-f' =&gt; 1),
- array('delimiter' =&gt; '')
- );
- $systemUsers = Command::create(
- 'cat',
- array('/etc/passwd')
- )
- -&gt;pipe(
- $grepCommand-&gt;pipe(
- $cutCommand
- )
- )
- -&gt;run()
- -&gt;getOutputAsArray("\n");
-</code></pre>
-
-<p>This class may take the following options:</p>
-
-<ul>
-<li><code>delimiter</code> (<code>string</code>): A string that will be put in key-value pairs of arguments to separate the key
- from its value. Defaults to '='.</li>
-</ul>
-
-<p><em class='docparam'>@author</em> José Nahuel Cuesta Luengo <a href="&#x6d;&#x61;&#105;&#108;&#116;&#x6f;&#x3a;&#x6e;&#97;&#104;u&#x65;&#x6c;&#99;&#117;&#101;&#x73;&#x74;&#x61;&#108;&#117;e&#x6e;&#x67;&#111;&#64;&#103;&#x6d;&#x61;&#x69;&#108;&#46;c&#x6f;&#x6d;">&#x6e;&#97;&#104;u&#x65;&#x6c;&#99;&#117;&#101;&#x73;&#x74;&#x61;&#108;&#117;e&#x6e;&#x67;&#111;&#64;&#103;&#x6d;&#x61;&#x69;&#108;&#46;c&#x6f;&#x6d;</a></p>
- </td>
- <td class="code">
- <div class="highlight"><pre><span class="k">class</span> <span class="nc">Command</span> <span class="k">implements</span> <span class="nx">CommandInterface</span><span class="p">,</span> <span class="nx">PipingCommandInterface</span><span class="p">,</span> <span class="nx">PipeableCommandInterface</span>
-<span class="p">{</span>
- <span class="k">const</span> <span class="no">DEFAULT_DELIMITER</span> <span class="o">=</span> <span class="s1">&#39;=&#39;</span><span class="p">;</span></pre></div> </td>
- </tr>
- <tr id="section-2">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-2">&#182;</a>
- </div>
- <p>The name of the command.</p>
-
-<p><em class='docparam'>@var</em> string</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">private</span> <span class="nv">$_name</span><span class="p">;</span></pre></div> </td>
- </tr>
- <tr id="section-3">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-3">&#182;</a>
- </div>
- <p>Arguments supplied for this command.</p>
-
-<p><em class='docparam'>@var</em> \Clinner\ValueHolder</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">private</span> <span class="nv">$_arguments</span><span class="p">;</span></pre></div> </td>
- </tr>
- <tr id="section-4">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-4">&#182;</a>
- </div>
- <p>Options supplied for this command.</p>
-
-<p><em class='docparam'>@var</em> \Clinner\ValueHolder</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">private</span> <span class="nv">$_options</span><span class="p">;</span></pre></div> </td>
- </tr>
- <tr id="section-5">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-5">&#182;</a>
- </div>
- <p>A command piped to this one, if any.</p>
-
-<p><em class='docparam'>@var</em> \Clinner\Command\PipeableCommandInterface</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">private</span> <span class="nv">$_next</span><span class="p">;</span></pre></div> </td>
- </tr>
- <tr id="section-6">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-6">&#182;</a>
- </div>
- <p>Exit code for this command.
- This value will only be set after it has been run.</p>
-
-<p><em class='docparam'>@var</em> int</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">private</span> <span class="nv">$_exitCode</span><span class="p">;</span></pre></div> </td>
- </tr>
- <tr id="section-7">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-7">&#182;</a>
- </div>
- <p>Output for this command.
- This value will only be set after it has been run.</p>
-
-<p><em class='docparam'>@var</em> string</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">private</span> <span class="nv">$_output</span><span class="p">;</span></pre></div> </td>
- </tr>
- <tr id="section-8">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-8">&#182;</a>
- </div>
- <p>Factory method for creating new Commands and allowing to take advantage of the
- fluent API provided by this class.</p>
-
-<p><em class='docparam'>@param</em> string $name The name of the command.
-<em class='docparam'>@param</em> array|\Clinner\ValueHolder $arguments (Optional) arguments for the command.
-<em class='docparam'>@param</em> array|\Clinner\ValueHolder $options (Optional) options for the command.</p>
-
-<p><em class='docparam'>@return</em> \Clinner\Command\Command</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">static</span> <span class="k">public</span> <span class="k">function</span> <span class="nf">create</span><span class="p">(</span><span class="nv">$name</span><span class="p">,</span> <span class="nv">$arguments</span> <span class="o">=</span> <span class="k">array</span><span class="p">(),</span> <span class="nv">$options</span> <span class="o">=</span> <span class="k">array</span><span class="p">())</span>
- <span class="p">{</span>
- <span class="k">return</span> <span class="k">new</span> <span class="k">static</span><span class="p">(</span><span class="nv">$name</span><span class="p">,</span> <span class="nv">$arguments</span><span class="p">,</span> <span class="nv">$options</span><span class="p">);</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-9">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-9">&#182;</a>
- </div>
- <p>Factory method for creating new Commands from their string representation,
- as if they were being run from the command line. If no valid commands are
- found, a NullCommand will be returned.
- For example:
- <code>
- $command = Command::fromString('cat /etc/hosts | grep localhost');
- </code>
- Is roughly equivalent to:
- <code>
- $command = Command::create('cat', array('/etc/hosts'))
- ->pipe(Command::create('grep', array('localhost')));
- </code></p>
-
-<p><em class='docparam'>@param</em> string $commandString The command string to parse.</p>
-
-<p><em class='docparam'>@return</em> \Clinner\Command\CommandInterface</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">static</span> <span class="k">public</span> <span class="k">function</span> <span class="nf">fromString</span><span class="p">(</span><span class="nv">$commandString</span><span class="p">)</span>
- <span class="p">{</span>
- <span class="nv">$splitCommands</span> <span class="o">=</span> <span class="nb">array_map</span><span class="p">(</span>
- <span class="k">function</span><span class="p">(</span><span class="nv">$str</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="nx">trim</span><span class="p">(</span><span class="nv">$str</span><span class="p">);</span> <span class="p">},</span>
- <span class="nb">explode</span><span class="p">(</span><span class="nx">self</span><span class="o">::</span><span class="na">PIPE</span><span class="p">,</span> <span class="nv">$commandString</span><span class="p">)</span>
- <span class="p">);</span>
-
- <span class="nv">$command</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">NullCommand</span><span class="p">();</span>
-
- <span class="k">foreach</span> <span class="p">(</span><span class="nv">$splitCommands</span> <span class="k">as</span> <span class="nv">$rawCommand</span><span class="p">)</span> <span class="p">{</span>
- <span class="nv">$command</span> <span class="o">=</span> <span class="nv">$command</span><span class="o">-&gt;</span><span class="na">pipe</span><span class="p">(</span><span class="k">static</span><span class="o">::</span><span class="na">parse</span><span class="p">(</span><span class="nv">$rawCommand</span><span class="p">));</span>
- <span class="p">}</span>
-
- <span class="k">return</span> <span class="nv">$command</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-10">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-10">&#182;</a>
- </div>
- <p>Parse a command from a string representation and return the resulting
- object.
- If no valid command is found, a NullCommand will be returned.</p>
-
-<p><em class='docparam'>@param</em> string $commandString The command string to parse.
-<em class='docparam'>@param</em> array $options (Optional) options for the command.</p>
-
-<p><em class='docparam'>@return</em> \Clinner\Command\CommandInterface</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">static</span> <span class="k">protected</span> <span class="k">function</span> <span class="nf">parse</span><span class="p">(</span><span class="nv">$commandString</span><span class="p">,</span> <span class="nv">$options</span> <span class="o">=</span> <span class="k">array</span><span class="p">())</span>
- <span class="p">{</span>
- <span class="nv">$members</span> <span class="o">=</span> <span class="nb">array_filter</span><span class="p">(</span><span class="nb">explode</span><span class="p">(</span><span class="s1">&#39; &#39;</span><span class="p">,</span> <span class="nv">$commandString</span><span class="p">));</span>
-
- <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">empty</span><span class="p">(</span><span class="nv">$members</span><span class="p">))</span> <span class="p">{</span>
- <span class="nv">$commandName</span> <span class="o">=</span> <span class="nb">array_shift</span><span class="p">(</span><span class="nv">$members</span><span class="p">);</span>
-
- <span class="k">return</span> <span class="k">new</span> <span class="nx">Command</span><span class="p">(</span><span class="nv">$commandName</span><span class="p">,</span> <span class="nv">$members</span><span class="p">,</span> <span class="nv">$options</span><span class="p">);</span>
- <span class="p">}</span>
-
- <span class="k">return</span> <span class="k">new</span> <span class="nx">NullCommand</span><span class="p">();</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-11">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-11">&#182;</a>
- </div>
- <p>Constructor.</p>
-
-<p><em class='docparam'>@param</em> string $name The name of the command.
-<em class='docparam'>@param</em> array|\Clinner\ValueHolder $arguments (Optional) arguments for the command.
-<em class='docparam'>@param</em> array|\Clinner\ValueHolder $options (Optional) options for the command.</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">__construct</span><span class="p">(</span><span class="nv">$name</span><span class="p">,</span> <span class="nv">$arguments</span> <span class="o">=</span> <span class="k">array</span><span class="p">(),</span> <span class="nv">$options</span> <span class="o">=</span> <span class="k">array</span><span class="p">())</span>
- <span class="p">{</span>
- <span class="nv">$this</span>
- <span class="o">-&gt;</span><span class="na">setName</span><span class="p">(</span><span class="nv">$name</span><span class="p">)</span>
- <span class="o">-&gt;</span><span class="na">setArguments</span><span class="p">(</span><span class="nv">$arguments</span><span class="p">)</span>
- <span class="o">-&gt;</span><span class="na">setOptions</span><span class="p">(</span><span class="nv">$options</span><span class="p">);</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-12">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-12">&#182;</a>
- </div>
- <p>Get the name of this command.</p>
-
-<p><em class='docparam'>@return</em> string</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">getName</span><span class="p">()</span>
- <span class="p">{</span>
- <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_name</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-13">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-13">&#182;</a>
- </div>
- <p>Set the name of this command to $name.</p>
-
-<p><em class='docparam'>@param</em> string $name The name to set.</p>
-
-<p><em class='docparam'>@return</em> \Clinner\Command\Command This instance, for a fluent API.</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">setName</span><span class="p">(</span><span class="nv">$name</span><span class="p">)</span>
- <span class="p">{</span>
- <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_name</span> <span class="o">=</span> <span class="nv">$name</span><span class="p">;</span>
-
- <span class="k">return</span> <span class="nv">$this</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-14">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-14">&#182;</a>
- </div>
- <p>Get the arguments for this command as a ValueHolder.</p>
-
-<p><em class='docparam'>@return</em> \Clinner\ValueHolder</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">getArguments</span><span class="p">()</span>
- <span class="p">{</span>
- <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_arguments</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-15">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-15">&#182;</a>
- </div>
- <p>Set this command's arguments as a whole.
- $arguments might either be an array or a ValueHolder.</p>
-
-<p><em class='docparam'>@see</em> \Clinner\ValueHolder::create()</p>
-
-<p><em class='docparam'>@param</em> \Clinner\ValueHolder|array $arguments The arguments for this command.</p>
-
-<p><em class='docparam'>@return</em> \Clinner\Command\Command This instance, for a fluent API.</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">setArguments</span><span class="p">(</span><span class="nv">$arguments</span><span class="p">)</span>
- <span class="p">{</span>
- <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_arguments</span> <span class="o">=</span> <span class="nx">ValueHolder</span><span class="o">::</span><span class="na">create</span><span class="p">(</span><span class="nv">$arguments</span><span class="p">);</span>
-
- <span class="k">return</span> <span class="nv">$this</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-16">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-16">&#182;</a>
- </div>
- <p>Get the options for this command as a ValueHolder.</p>
-
-<p><em class='docparam'>@return</em> \Clinner\ValueHolder</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">getOptions</span><span class="p">()</span>
- <span class="p">{</span>
- <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_options</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-17">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-17">&#182;</a>
- </div>
- <p>Set this command's options as a whole.
- $options might either be an array or a ValueHolder.</p>
-
-<p><em class='docparam'>@see</em> \Clinner\ValueHolder::create()</p>
-
-<p><em class='docparam'>@param</em> \Clinner\ValueHolder|array $options The options for this command.</p>
-
-<p><em class='docparam'>@return</em> \Clinner\Command\Command This instance, for a fluent API.</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">setOptions</span><span class="p">(</span><span class="nv">$options</span><span class="p">)</span>
- <span class="p">{</span>
- <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_options</span> <span class="o">=</span> <span class="nx">ValueHolder</span><span class="o">::</span><span class="na">create</span><span class="p">(</span><span class="nv">$options</span><span class="p">);</span>
-
- <span class="k">return</span> <span class="nv">$this</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-18">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-18">&#182;</a>
- </div>
- <p>Get a single option value for this command, optionally providing a default value
- for it.</p>
-
-<p><em class='docparam'>@see</em> \Clinner\ValueHolder::get()</p>
-
-<p><em class='docparam'>@param</em> string $name The name of the option.
-<em class='docparam'>@param</em> mixed $default The default value for the option, in case it isn't set.</p>
-
-<p><em class='docparam'>@return</em> mixed</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">getOption</span><span class="p">(</span><span class="nv">$name</span><span class="p">,</span> <span class="nv">$default</span> <span class="o">=</span> <span class="k">null</span><span class="p">)</span>
- <span class="p">{</span>
- <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_options</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="nv">$name</span><span class="p">,</span> <span class="nv">$default</span><span class="p">);</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-19">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-19">&#182;</a>
- </div>
- <p>Set a single option for this command.</p>
-
-<p><em class='docparam'>@param</em> string $name Name of the option to set.
-<em class='docparam'>@param</em> mixed $value Value for that option.</p>
-
-<p><em class='docparam'>@return</em> \Clinner\Command\Command This instance, for a fluent API.</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">setOption</span><span class="p">(</span><span class="nv">$name</span><span class="p">,</span> <span class="nv">$value</span><span class="p">)</span>
- <span class="p">{</span>
- <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_options</span><span class="o">-&gt;</span><span class="na">set</span><span class="p">(</span><span class="nv">$name</span><span class="p">,</span> <span class="nv">$value</span><span class="p">);</span>
-
- <span class="k">return</span> <span class="nv">$this</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-20">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-20">&#182;</a>
- </div>
- <p>Get the command piped to this one, if any.</p>
-
-<p><em class='docparam'>@return</em> \Clinner\Command\PipeableCommandInterface</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">getPipedCommand</span><span class="p">()</span>
- <span class="p">{</span>
- <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_next</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-21">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-21">&#182;</a>
- </div>
- <p>Pipe $anotherCommand to this one, so that this command's output is directly
- sent to $anotherCommand's standard input.</p>
-
-<p><em class='docparam'>@param</em> \Clinner\Command\PipeableCommandInterface $anotherCommand The command to pipe.
-<em class='docparam'>@param</em> bool $appendToPipe Whether $anotherCommand will be appended to
- the currently piped commands (TRUE) or if it
- will be added after this command, rearranging
- the commands pipe to include it.</p>
-
-<p><em class='docparam'>@return</em> \Clinner\Command\PipingCommandInterface This instance, for a fluent API.</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">pipe</span><span class="p">(</span><span class="nx">PipeableCommandInterface</span> <span class="nv">$anotherCommand</span><span class="p">,</span> <span class="nv">$appendToPipe</span> <span class="o">=</span> <span class="k">true</span><span class="p">)</span>
- <span class="p">{</span>
- <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nv">$anotherCommand</span> <span class="nx">instanceof</span> <span class="nx">NullCommand</span><span class="p">)</span> <span class="p">{</span>
- <span class="k">if</span> <span class="p">(</span><span class="nv">$this</span> <span class="o">===</span> <span class="nv">$anotherCommand</span><span class="p">)</span> <span class="p">{</span></pre></div> </td>
- </tr>
- <tr id="section-22">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-22">&#182;</a>
- </div>
- <p>Cannot pipe a command to itself, need to clone it</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="nv">$anotherCommand</span> <span class="o">=</span> <span class="k">clone</span> <span class="nv">$anotherCommand</span><span class="p">;</span>
- <span class="p">}</span>
-
- <span class="k">if</span> <span class="p">(</span><span class="nv">$appendToPipe</span><span class="p">)</span> <span class="p">{</span>
- <span class="k">if</span> <span class="p">(</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">hasPipedCommand</span><span class="p">())</span> <span class="p">{</span>
- <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_next</span><span class="o">-&gt;</span><span class="na">pipe</span><span class="p">(</span><span class="nv">$anotherCommand</span><span class="p">,</span> <span class="k">true</span><span class="p">);</span>
- <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
- <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_next</span> <span class="o">=</span> <span class="nv">$anotherCommand</span><span class="p">;</span>
- <span class="p">}</span>
- <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
- <span class="k">if</span> <span class="p">(</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">hasPipedCommand</span><span class="p">())</span> <span class="p">{</span></pre></div> </td>
- </tr>
- <tr id="section-23">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-23">&#182;</a>
- </div>
- <p>Rearrange the commands pipe</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="nv">$anotherCommand</span><span class="o">-&gt;</span><span class="na">pipe</span><span class="p">(</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_next</span><span class="p">,</span> <span class="k">false</span><span class="p">);</span>
- <span class="p">}</span>
-
- <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_next</span> <span class="o">=</span> <span class="nv">$anotherCommand</span><span class="p">;</span>
- <span class="p">}</span>
- <span class="p">}</span>
-
- <span class="k">return</span> <span class="nv">$this</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-24">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-24">&#182;</a>
- </div>
- <p>Answer whether this command has a command piped to it.</p>
-
-<p><em class='docparam'>@return</em> bool</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">hasPipedCommand</span><span class="p">()</span>
- <span class="p">{</span>
- <span class="k">return</span> <span class="k">null</span> <span class="o">!==</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_next</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-25">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-25">&#182;</a>
- </div>
- <p>Get the exit code for this command.</p>
-
-<p><em class='docparam'>@return</em> int</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">getExitCode</span><span class="p">()</span>
- <span class="p">{</span>
- <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_exitCode</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-26">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-26">&#182;</a>
- </div>
- <p>Get this command's output.</p>
-
-<p><em class='docparam'>@return</em> string</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">getOutput</span><span class="p">()</span>
- <span class="p">{</span>
- <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_output</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-27">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-27">&#182;</a>
- </div>
- <p>Get the output of this command as an array, splitting it with a given $delimiter.
- If no output has been generated by this command, an empty array will be returned.</p>
-
-<p><em class='docparam'>@see</em> explode</p>
-
-<p><em class='docparam'>@param</em> string $delimiter The boundary string.</p>
-
-<p><em class='docparam'>@return</em> array</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">getOutputAsArray</span><span class="p">(</span><span class="nv">$delimiter</span> <span class="o">=</span> <span class="s1">&#39; &#39;</span><span class="p">)</span>
- <span class="p">{</span>
- <span class="k">return</span> <span class="nb">array_values</span><span class="p">(</span>
- <span class="nb">array_filter</span><span class="p">(</span>
- <span class="nb">explode</span><span class="p">(</span><span class="nv">$delimiter</span><span class="p">,</span> <span class="nb">strval</span><span class="p">(</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_output</span><span class="p">))</span>
- <span class="p">)</span>
- <span class="p">);</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-28">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-28">&#182;</a>
- </div>
- <p>Run this command with the given $input.
- If this command has any other command piped to it, the other command
- will also be run as well, with this command's output as its input.</p>
-
-<p><em class='docparam'>@param</em> string $input (Optional) input for this command.</p>
-
-<p><em class='docparam'>@return</em> \Clinner\Command\Command This instance, for a fluent API.</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">run</span><span class="p">(</span><span class="nv">$input</span> <span class="o">=</span> <span class="k">null</span><span class="p">)</span>
- <span class="p">{</span>
- <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_exitCode</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_run</span><span class="p">(</span><span class="nv">$input</span><span class="p">);</span>
-
- <span class="k">return</span> <span class="nv">$this</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-29">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-29">&#182;</a>
- </div>
- <p>Actually run this command and its piped commands chain, if applicable.
- Return the exit code for such execution.</p>
-
-<p><em class='docparam'>@throws</em> \RuntimeException If unable to run the command.</p>
-
-<p><em class='docparam'>@param</em> string $input Input to this command.</p>
-
-<p><em class='docparam'>@return</em> int</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">protected</span> <span class="k">function</span> <span class="nf">_run</span><span class="p">(</span><span class="nv">$input</span><span class="p">)</span>
- <span class="p">{</span>
- <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_output</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span><span class="p">;</span>
-
- <span class="nv">$descriptors</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span>
- <span class="mi">0</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;pipe&#39;</span><span class="p">,</span> <span class="s1">&#39;r&#39;</span><span class="p">),</span>
- <span class="mi">1</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;pipe&#39;</span><span class="p">,</span> <span class="s1">&#39;w&#39;</span><span class="p">),</span>
- <span class="p">);</span>
- <span class="nv">$pipes</span> <span class="o">=</span> <span class="k">array</span><span class="p">();</span>
-
- <span class="nv">$childProcess</span> <span class="o">=</span> <span class="nb">proc_open</span><span class="p">(</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">toCommandString</span><span class="p">(),</span> <span class="nv">$descriptors</span><span class="p">,</span> <span class="nv">$pipes</span><span class="p">);</span>
-
- <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nb">is_resource</span><span class="p">(</span><span class="nv">$childProcess</span><span class="p">))</span> <span class="p">{</span>
- <span class="k">throw</span> <span class="k">new</span> <span class="nx">\RuntimeException</span><span class="p">(</span><span class="s1">&#39;Unable to run command: &#39;</span> <span class="o">.</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">toCommandString</span><span class="p">());</span>
- <span class="p">}</span>
-
- <span class="k">if</span> <span class="p">(</span><span class="k">null</span> <span class="o">!==</span> <span class="nv">$input</span><span class="p">)</span> <span class="p">{</span>
- <span class="nb">fwrite</span><span class="p">(</span><span class="nv">$pipes</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="nv">$input</span><span class="p">);</span>
- <span class="nb">fclose</span><span class="p">(</span><span class="nv">$pipes</span><span class="p">[</span><span class="mi">0</span><span class="p">]);</span>
- <span class="p">}</span>
-
- <span class="nv">$output</span> <span class="o">=</span> <span class="nb">stream_get_contents</span><span class="p">(</span><span class="nv">$pipes</span><span class="p">[</span><span class="mi">1</span><span class="p">]);</span>
- <span class="nb">fclose</span><span class="p">(</span><span class="nv">$pipes</span><span class="p">[</span><span class="mi">1</span><span class="p">]);</span>
-
- <span class="nv">$exitCode</span> <span class="o">=</span> <span class="nb">proc_close</span><span class="p">(</span><span class="nv">$childProcess</span><span class="p">);</span></pre></div> </td>
- </tr>
- <tr id="section-30">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-30">&#182;</a>
- </div>
- <p>Run the piped command, if any</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">if</span> <span class="p">(</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">hasPipedCommand</span><span class="p">())</span> <span class="p">{</span>
- <span class="nv">$pipedCommand</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getPipedCommand</span><span class="p">();</span>
-
- <span class="nv">$pipedCommand</span><span class="o">-&gt;</span><span class="na">run</span><span class="p">(</span><span class="nv">$output</span><span class="p">);</span>
-
- <span class="nv">$output</span> <span class="o">=</span> <span class="nv">$pipedCommand</span><span class="o">-&gt;</span><span class="na">getOutput</span><span class="p">();</span>
- <span class="nv">$exitCode</span> <span class="o">=</span> <span class="nv">$pipedCommand</span><span class="o">-&gt;</span><span class="na">getExitCode</span><span class="p">();</span>
- <span class="p">}</span>
-
- <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">_output</span> <span class="o">=</span> <span class="nv">$output</span><span class="p">;</span>
-
- <span class="k">return</span> <span class="nv">$exitCode</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-31">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-31">&#182;</a>
- </div>
- <p>Get a string representation of this command with its arguments,
- as if it would be written in a command-line interface when run.</p>
-
-<p><em class='docparam'>@param</em> bool $includePiped (Optional) indicates whether the resulting
- string will include any piped command to this
- one. Defaults to FALSE.</p>
-
-<p><em class='docparam'>@return</em> string</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">toCommandString</span><span class="p">(</span><span class="nv">$includePiped</span> <span class="o">=</span> <span class="k">false</span><span class="p">)</span>
- <span class="p">{</span>
- <span class="nv">$command</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getName</span><span class="p">();</span>
-
- <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getArguments</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">isEmpty</span><span class="p">())</span> <span class="p">{</span>
- <span class="nv">$args</span> <span class="o">=</span> <span class="k">array</span><span class="p">();</span>
-
- <span class="nv">$delimiter</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getOption</span><span class="p">(</span><span class="s1">&#39;delimiter&#39;</span><span class="p">,</span> <span class="nx">self</span><span class="o">::</span><span class="na">DEFAULT_DELIMITER</span><span class="p">);</span>
-
- <span class="k">foreach</span> <span class="p">(</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getArguments</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">getAll</span><span class="p">()</span> <span class="k">as</span> <span class="nv">$key</span> <span class="o">=&gt;</span> <span class="nv">$value</span><span class="p">)</span> <span class="p">{</span>
- <span class="k">if</span> <span class="p">(</span><span class="nb">is_int</span><span class="p">(</span><span class="nv">$key</span><span class="p">))</span> <span class="p">{</span>
- <span class="nv">$args</span><span class="p">[]</span> <span class="o">=</span> <span class="nv">$value</span><span class="p">;</span>
- <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
- <span class="nv">$args</span><span class="p">[]</span> <span class="o">=</span> <span class="nv">$key</span><span class="o">.</span><span class="nv">$delimiter</span><span class="o">.</span><span class="nv">$value</span><span class="p">;</span>
- <span class="p">}</span>
- <span class="p">}</span>
-
- <span class="nv">$command</span> <span class="o">.=</span> <span class="s1">&#39; &#39;</span> <span class="o">.</span> <span class="nb">implode</span><span class="p">(</span><span class="s1">&#39; &#39;</span><span class="p">,</span> <span class="nv">$args</span><span class="p">);</span>
- <span class="p">}</span>
-
- <span class="k">if</span> <span class="p">(</span><span class="nv">$includePiped</span> <span class="o">&amp;&amp;</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">hasPipedCommand</span><span class="p">())</span> <span class="p">{</span>
- <span class="nv">$command</span> <span class="o">.=</span> <span class="nb">sprintf</span><span class="p">(</span><span class="s1">&#39; %s %s&#39;</span><span class="p">,</span> <span class="nx">self</span><span class="o">::</span><span class="na">PIPE</span><span class="p">,</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getPipedCommand</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">toCommandString</span><span class="p">(</span><span class="nv">$includePiped</span><span class="p">));</span>
- <span class="p">}</span>
-
- <span class="k">return</span> <span class="nv">$command</span><span class="p">;</span>
- <span class="p">}</span></pre></div> </td>
- </tr>
- <tr id="section-32">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-32">&#182;</a>
- </div>
- <p>Get the string representation of this command.</p>
-
-<p><em class='docparam'>@return</em> string</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">__toString</span><span class="p">()</span>
- <span class="p">{</span>
- <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">getName</span><span class="p">();</span>
- <span class="p">}</span>
-<span class="p">}</span>
-</pre></div></pre></div> </td>
- </tr>
- </tbody>
- </table>
- </div>
-</body>
-</html>
View
217 doc/Clinner/Command/CommandInterface.html
@@ -1,217 +0,0 @@
-<!DOCTYPE html>
-
-<html>
-<head>
- <title>CommandInterface.php</title>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <link rel="stylesheet" media="all" href="layout.css" />
- <style>
- /*--------------------- Layout and Typography ----------------------------*/
-body { font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; font-size: 15px; line-height: 22px; color: #252519; margin: 0; padding: 0;
-}
-a { color: #261a3b;
-} a:visited { color: #261a3b; }
-p { margin: 0 0 15px 0;
-}
-h1, h2, h3, h4, h5, h6 { margin: 40px 0 15px 0;
-} h3, h4, h5, h6 { margin-top: 20px; }
-#container { position: relative;
-}
-#background { position: fixed; top: 0; left: 575px; right: 0; bottom: 0; background: #f5f5ff; border-left: 1px solid #e5e5ee; z-index: -1;
-}
-#jump_to, #jump_page { background: white; -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; font: 10px Arial; text-transform: uppercase; cursor: pointer; text-align: right;
-}
-#jump_to, #jump_wrapper { position: fixed; right: 0; top: 0; padding: 5px 10px;
-} #jump_wrapper { padding: 0; display: none; } #jump_to:hover #jump_wrapper { display: block; } #jump_page { padding: 5px 0 3px; margin: 0 0 25px 25px; overflow:hidden; } #jump_page .source { display: block; padding: 5px 10px; text-decoration: none; border-top: 1px solid #eee; float:left; min-width:180px; text-align:left; text-transform:none; font-size:11px; } #jump_page .source:hover { background: #f5f5ff; } #jump_page .source:first-child { }
-table td { border: 0; outline: 0;
-} td.docs, th.docs { max-width: 450px; min-width: 450px; min-height: 5px; padding: 10px 25px 1px 50px; overflow-x: hidden; vertical-align: top; text-align: left; } .docs pre { margin: 15px 0 15px; padding-left: 15px; } .docs p tt, .docs p code { background: #f8f8ff; border: 1px solid #dedede; font-size: 12px; padding: 0 0.2em; } .pilwrap { position: relative; } .pilcrow { font: 12px Arial; text-decoration: none; color: #454545; position: absolute; top: 3px; left: -20px; padding: 1px 2px; opacity: 0; -webkit-transition: opacity 0.2s linear; } td.docs:hover .pilcrow { opacity: 1; } td.code, th.code { padding: 14px 15px 16px 25px; width: 100%; vertical-align: top; background: #f5f5ff; border-left: 1px solid #e5e5ee; } pre, tt, code { font-size: 12px; line-height: 18px; font-family: Monaco, Consolas, "Lucida Console", monospace; margin: 0; padding: 0; } /*---------------------- Syntax Highlighting -----------------------------*/
-td.linenos { background-color: #f0f0f0; padding-right: 10px; }
-span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
-body .hll { background-color: #ffffcc }
-body .c { color: #408080; font-style: italic } /* Comment */
-body .err { border: 1px solid #FF0000 } /* Error */
-body .k { color: #954121 } /* Keyword */
-body .o { color: #666666 } /* Operator */
-body .cm { color: #408080; font-style: italic } /* Comment.Multiline */
-body .cp { color: #BC7A00 } /* Comment.Preproc */
-body .c1 { color: #408080; font-style: italic } /* Comment.Single */
-body .cs { color: #408080; font-style: italic } /* Comment.Special */
-body .gd { color: #A00000 } /* Generic.Deleted */
-body .ge { font-style: italic } /* Generic.Emph */
-body .gr { color: #FF0000 } /* Generic.Error */
-body .gh { color: #000080; font-weight: bold } /* Generic.Heading */
-body .gi { color: #00A000 } /* Generic.Inserted */
-body .go { color: #808080 } /* Generic.Output */
-body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
-body .gs { font-weight: bold } /* Generic.Strong */
-body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
-body .gt { color: #0040D0 } /* Generic.Traceback */
-body .kc { color: #954121 } /* Keyword.Constant */
-body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */
-body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */
-body .kp { color: #954121 } /* Keyword.Pseudo */
-body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */
-body .kt { color: #B00040 } /* Keyword.Type */
-body .m { color: #666666 } /* Literal.Number */
-body .s { color: #219161 } /* Literal.String */
-body .na { color: #7D9029 } /* Name.Attribute */
-body .nb { color: #954121 } /* Name.Builtin */
-body .nc { color: #0000FF; font-weight: bold } /* Name.Class */
-body .no { color: #880000 } /* Name.Constant */
-body .nd { color: #AA22FF } /* Name.Decorator */
-body .ni { color: #999999; font-weight: bold } /* Name.Entity */
-body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
-body .nf { color: #0000FF } /* Name.Function */
-body .nl { color: #A0A000 } /* Name.Label */
-body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
-body .nt { color: #954121; font-weight: bold } /* Name.Tag */
-body .nv { color: #19469D } /* Name.Variable */
-body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
-body .w { color: #bbbbbb } /* Text.Whitespace */
-body .mf { color: #666666 } /* Literal.Number.Float */
-body .mh { color: #666666 } /* Literal.Number.Hex */
-body .mi { color: #666666 } /* Literal.Number.Integer */
-body .mo { color: #666666 } /* Literal.Number.Oct */
-body .sb { color: #219161 } /* Literal.String.Backtick */
-body .sc { color: #219161 } /* Literal.String.Char */
-body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */
-body .s2 { color: #219161 } /* Literal.String.Double */
-body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
-body .sh { color: #219161 } /* Literal.String.Heredoc */
-body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
-body .sx { color: #954121 } /* Literal.String.Other */
-body .sr { color: #BB6688 } /* Literal.String.Regex */
-body .s1 { color: #219161 } /* Literal.String.Single */
-body .ss { color: #19469D } /* Literal.String.Symbol */
-body .bp { color: #954121 } /* Name.Builtin.Pseudo */
-body .vc { color: #19469D } /* Name.Variable.Class */
-body .vg { color: #19469D } /* Name.Variable.Global */
-body .vi { color: #19469D } /* Name.Variable.Instance */
-body .il { color: #666666 } /* Literal.Number.Integer.Long */ /********** PHP Comment Additions ********/
-td.docs .docparam {color:#DB251A;font-weight:bold;}
- </style>
-</head>
-<body>
- <div id="container">
- <div id="background"></div>
- <div id="jump_to">
- Jump To &hellip;
- <div id="jump_wrapper">
- <div id="jump_page">
- <a class="source" href="../../Clinner/Command/Callback.html">
- Callback.php </a>
- <a class="source" href="../../Clinner/Command/Command.html">
- Command.php </a>
- <a class="source" href="../../Clinner/Command/CommandInterface.html">
- CommandInterface.php </a>
- <a class="source" href="../../Clinner/Command/NullCommand.html">
- NullCommand.php </a>
- <a class="source" href="../../Clinner/Command/PipeableCommandInterface.html">
- PipeableCommandInterface.php </a>
- <a class="source" href="../../Clinner/Command/PipingCommandInterface.html">
- PipingCommandInterface.php </a>
- <a class="source" href="../../Clinner/ValueHolder.html">
- ValueHolder.php </a>
- </div>
- </div>
- </div>
- <table cellpadding="0" cellspacing="0">
- <thead>
- <tr>
- <th class="docs">
- <h1>
- CommandInterface.php </h1>
- </th>
- <th class="code">
- </th>
- </tr>
- </thead>
- <tbody>
- <tr id="section-0">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-0">&#182;</a>
- </div>
- <p>This file is part of the Clinner library.</p>
-
-<p>(c) José Nahuel Cuesta Luengo <a href="&#x6d;&#x61;&#105;&#108;&#116;&#x6f;&#x3a;&#x6e;&#97;&#104;u&#x65;&#x6c;&#99;&#117;&#101;&#x73;&#x74;&#x61;&#108;&#117;e&#x6e;&#x67;&#111;&#64;&#103;&#x6d;&#x61;&#x69;&#108;&#46;c&#x6f;&#x6d;">&#x6e;&#97;&#104;u&#x65;&#x6c;&#99;&#117;&#101;&#x73;&#x74;&#x61;&#108;&#117;e&#x6e;&#x67;&#111;&#64;&#103;&#x6d;&#x61;&#x69;&#108;&#46;c&#x6f;&#x6d;</a></p>
-
-<p>For the full copyright and license information, please view the LICENSE
- file that was distributed with this source code.</p>
- </td>
- <td class="code">
- <div class="highlight"><pre><span class="k">namespace</span> <span class="nx">Clinner\Command</span><span class="p">;</span></pre></div> </td>
- </tr>
- <tr id="section-1">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-1">&#182;</a>
- </div>
- <p>Command Interface
- Interface to be implemented by Commands.</p>
-
-<p><em class='docparam'>@author</em> José Nahuel Cuesta Luengo <a href="&#x6d;&#x61;&#105;&#108;&#116;&#x6f;&#x3a;&#x6e;&#97;&#104;u&#x65;&#x6c;&#99;&#117;&#101;&#x73;&#x74;&#x61;&#108;&#117;e&#x6e;&#x67;&#111;&#64;&#103;&#x6d;&#x61;&#x69;&#108;&#46;c&#x6f;&#x6d;">&#x6e;&#97;&#104;u&#x65;&#x6c;&#99;&#117;&#101;&#x73;&#x74;&#x61;&#108;&#117;e&#x6e;&#x67;&#111;&#64;&#103;&#x6d;&#x61;&#x69;&#108;&#46;c&#x6f;&#x6d;</a></p>
- </td>
- <td class="code">
- <div class="highlight"><pre><span class="k">interface</span> <span class="nx">CommandInterface</span>
-<span class="p">{</span></pre></div> </td>
- </tr>
- <tr id="section-2">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-2">&#182;</a>
- </div>
- <p>Run this command and get the exit code for it.</p>
-
-<p><em class='docparam'>@param</em> string $input (Optional) input string for this command.</p>
-
-<p><em class='docparam'>@return</em> \Clinner\Command\CommandInterface This command, for a fluent API.</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">run</span><span class="p">(</span><span class="nv">$input</span> <span class="o">=</span> <span class="k">null</span><span class="p">);</span></pre></div> </td>
- </tr>
- <tr id="section-3">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-3">&#182;</a>
- </div>
- <p>Get the exit code for this command's execution.
- This method will only return a valid value after the command has been executed.</p>
-
-<p><em class='docparam'>@return</em> int</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">getExitCode</span><span class="p">();</span></pre></div> </td>
- </tr>
- <tr id="section-4">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-4">&#182;</a>
- </div>
- <p>Get the output for this command's execution.
- This method will only return a valid value after the command has been executed.</p>
-
-<p><em class='docparam'>@return</em> string</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">getOutput</span><span class="p">();</span></pre></div> </td>
- </tr>
- <tr id="section-5">
- <td class="docs">
- <div class="pilwrap">
- <a class="pilcrow" href="#section-5">&#182;</a>
- </div>
- <p>Get a string representing this command.</p>
-
-<p><em class='docparam'>@return</em> string</p>
- </td>
- <td class="code">
- <div class="highlight"><pre> <span class="k">public</span> <span class="k">function</span> <span class="nf">toCommandString</span><span class="p">();</span>
-<span class="p">}</span>
-</pre></div></pre></div> </td>
- </tr>
- </tbody>
- </table>
- </div>
-</body>
-</html>
View
318 doc/Clinner/Command/NullCommand.html
@@ -1,318 +0,0 @@
-<!DOCTYPE html>
-
-<html>
-<head>
- <title>NullCommand.php</title>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <link rel="stylesheet" media="all" href="layout.css" />
- <style>
- /*--------------------- Layout and Typography ----------------------------*/
-body { font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; font-size: 15px; line-height: 22px; color: #252519; margin: 0; padding: 0;
-}
-a { color: #261a3b;
-} a:visited { color: #261a3b; }
-p { margin: 0 0 15px 0;
-}
-h1, h2, h3, h4, h5, h6 { margin: 40px 0 15px 0;
-} h3, h4, h5, h6 { margin-top: 20px; }
-#container { position: relative;
-}
-#background { position: fixed; top: 0; left: 575px; right: 0; bottom: 0; background: #f5f5ff; border-left: 1px solid #e5e5ee; z-index: -1;
-}
-#jump_to, #jump_page { background: white; -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; font: 10px Arial; text-transform: uppercase; cursor: pointer; text-align: right;
-}
-#jump_to, #jump_wrapper { position: fixed; right: 0; top: 0; padding: 5px 10px;
-} #jump_wrapper { padding: 0; display: none; } #jump_to:hover #jump_wrapper { display: block; } #jump_page { padding: 5px 0 3px; margin: 0 0 25px 25px; overflow:hidden; } #jump_page .source { display: block; padding: 5px 10px; text-decoration: none; border-top: 1px solid #eee; float:left; min-width:180px; text-align:left; text-transform:none; font-size:11px; } #jump_page .source:hover { background: #f5f5ff; } #jump_page .source:first-child { }
-table td { border: 0; outline: 0;
-} td.docs, th.docs { max-width: 450px; min-width: 450px; min-height: 5px; padding: 10px 25px 1px 50px; overflow-x: hidden; vertical-align: top; text-align: left; } .docs pre { margin: 15px 0 15px; padding-left: 15px; } .docs p tt, .docs p code { background: #f8f8ff; border: 1px solid #dedede; font-size: 12px; padding: 0 0.2em; } .pilwrap { position: relative; } .pilcrow { font: 12px Arial; text-decoration: none; color: #454545; position: absolute; top: 3px; left: -20px; padding: 1px 2px; opacity: 0; -webkit-transition: opacity 0.2s linear; } td.docs:hover .pilcrow { opacity: 1; } td.code, th.code { padding: 14px 15px 16px 25px; width: 100%; vertical-align: top; background: #f5f5ff; border-left: 1px solid #e5e5ee; } pre, tt, code { font-size: 12px; line-height: 18px; font-family: Monaco, Consolas, "Lucida Console", monospace; margin: 0; padding: 0; } /*---------------------- Syntax Highlighting -----------------------------*/
-td.linenos { background-color: #f0f0f0; padding-right: 10px; }
-span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
-body .hll { background-color: #ffffcc }
-body .c { color: #408080; font-style: italic } /* Comment */
-body .err { border: 1px solid #FF0000 } /* Error */
-body .k { color: #954121 } /* Keyword */
-body .o { color: #666666 } /* Operator */
-body .cm { color: #408080; font-style: italic } /* Comment.Multiline */
-body .cp { color: #BC7A00 } /* Comment.Preproc */
-body .c1 { color: #408080; font-style: italic } /* Comment.Single */
-body .cs { color: #408080; font-style: italic } /* Comment.Special */
-body .gd { color: #A00000 } /* Generic.Deleted */
-body .ge { font-style: italic } /* Generic.Emph */
-body .gr { color: #FF0000 } /* Generic.Error */
-body .gh { color: #000080; font-weight: bold } /* Generic.Heading */
-body .gi { color: #00A000 } /* Generic.Inserted */
-body .go { color: #808080 } /* Generic.Output */
-body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
-body .gs { font-weight: bold } /* Generic.Strong */
-body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
-body .gt { color: #0040D0 } /* Generic.Traceback */
-body .kc { color: #954121 } /* Keyword.Constant */
-body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */
-body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */
-body .kp { color: #954121 } /* Keyword.Pseudo */
-body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */
-body .kt { color: #B00040 } /* Keyword.Type */
-body .m { color: #666666 } /* Literal.Number */
-body .s { color: #219161 } /* Literal.String */
-body .na { color: #7D9029 } /* Name.Attribute */
-body .nb { color: #954121 } /* Name.Builtin */
-body .nc { color: #0000FF; font-weight: bold } /* Name.Class */
-body .no {