<commit_before><?php
/**
 * Command.php
 *
 * @package   Ymmtmsys\Command
 * @author    ymmtmsys
 * @copyright Copyright (c) 2012 ymmtmsys
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
 * @link      https://github.com/ymmtmsys/command
 *
 *
 * This class is intended to make it easy to perform a unit test.
 * 
 * `````````````````````````````````````
 * <?php
 * //
 * // It is difficult to perform Unit test.
 * //
 * class Foobar 
 * {
 *     public function dummy()
 *     {
 *         // before process ...
 * 
 *         exec($command, $output, $returnvar);
 * 
 *         // after process  ...
 *     }
 * }
 * 
 * //
 * // Practice of Unit test becomes easy by using Command class. 
 * //
 * class Hoover 
 * {
 *     public function __construct($cmd) // $cmd is a Command instance
 *     {
 *         $this->cmd = $cmd;
 *     }
 * 
 *     public function dam()
 *     {
 *         // before process ...
 * 
 *         $this->cmd->exec($command);
 * 
 *         // after process  ...
 *     }
 * }
 * `````````````````````````````````````
 */
namespace Ymmtmsys\Command;

class Command
{
    /**
     * @var array
     *      Will be filled with every line of output from the command.
     */
    protected $output = array();

    /**
     * @var int
     *      return status of the executed command
     *      will be written to this variable.
     */
    protected $return_var = 0;

    /**
     * @param  string $command The command that will be executed.
     * @return The last line from the result of the command.
     */
    public function exec($command)
    {
        return exec($command, $this->output, $this->return_var);
    }

    /**
     * @param  string $name name of property<commit_msg>fixed memory leak + output consistency<commit_after><?php
/**
 * Command.php
 *
 * @package   Ymmtmsys\Command
 * @author    ymmtmsys
 * @copyright Copyright (c) 2012 ymmtmsys
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
 * @link      https://github.com/ymmtmsys/command
 *
 *
 * This class is intended to make it easy to perform a unit test.
 * 
 * `````````````````````````````````````
 * <?php
 * //
 * // It is difficult to perform Unit test.
 * //
 * class Foobar 
 * {
 *     public function dummy()
 *     {
 *         // before process ...
 * 
 *         exec($command, $output, $returnvar);
 * 
 *         // after process  ...
 *     }
 * }
 * 
 * //
 * // Practice of Unit test becomes easy by using Command class. 
 * //
 * class Hoover 
 * {
 *     public function __construct($cmd) // $cmd is a Command instance
 *     {
 *         $this->cmd = $cmd;
 *     }
 * 
 *     public function dam()
 *     {
 *         // before process ...
 * 
 *         $this->cmd->exec($command);
 * 
 *         // after process  ...
 *     }
 * }
 * `````````````````````````````````````
 */
namespace Ymmtmsys\Command;

class Command
{
    /**
     * @var array
     *      Will be filled with every line of output from the command.
     */
    protected $output = array();

    /**
     * @var int
     *      return status of the executed command
     *      will be written to this variable.
     */
    protected $return_var = 0;

    /**
     * @param  string $command The command that will be executed.
     * @return The last line from the result of the command.
     */
    public function exec($command)
    {
        $this->output = array();
        $this->return_var = 0;
        
        return exec($command, $this->output, $this->return_var);
    }

    /**
     * @param  string $name name of property
{'fraction_non_alphanumeric': 0.17197986577181207, 'fraction_numerical': 0.003076062639821029, 'mean_word_length': 1.8823529411764706, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '950639', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1061, 'n_words': 303}