<commit_before><?php
/**
 * Created by PhpStorm.
 * User: rgladson
 * Date: 4/8/2016
 * Time: 11:18 AM
 */
// All errors on
namespace {
  error_reporting(E_ALL);
}
// Load the autoload file.
namespace {
  $autoloader = __DIR__ . '/vendor/autoload.php';
  if (!file_exists($autoloader)) {
    echo "Composer autoloader not found: $autoloader" . PHP_EOL;
    echo "Please issue 'composer install' and try again." . PHP_EOL;
    exit(1);
  }
  require $autoloader;
}


// Define some dummy test functions that can be shared
namespace tests\PHPixme {

  use PHPixme\AssertTypeTrait;
  use PHPixme\ClosedTrait;
  const Closure = \Closure::class;
  // To reduce the amount of pain caused by using reflection if there is a refactor.
  const shortName = 'shortName';

  const doNotRun = __NAMESPACE__ . '\doNotRun';
  function doNotRun()
  {
    throw new \Exception('Callback should of not ran.');
  }

  const noop = __NAMESPACE__ . '\noop';
  function noop()
  {
    // This space is intentionally left blank
  }

  function getArgs()
  {
    return func_get_args();
  }

  class AssertTypeStub
  {
    use AssertTypeTrait;
  }

  /**
   * Class CloseTypeStub
   * @property void $exceptionFoo
   * @package tests\PHPixme
   */
  class CloseTypeStub
  {
    use ClosedTrait;
  }

  class TestClass
  {
    public $value = true;

    static public function testStatic()
    {
      return func_get_args();
    }

    public function getArgs()
    {
      return func_get_args();
    }

    public function countArgs()
    {
      return func_num_args();
    }
  }

  class invokable
  {
    public function __invoke($x)
    {
      return $x;
    }
  }

  class JustAIterator implements \Iterator
  {
    private $data = [];
    private $valid = true;

    public function current()
    {
      return current($this->data);
    }

    public function next()
    {
      $this->valid = false !== each($this->data);
    }

    public function key()
    {
      return key($this->data);
    }

    public function valid()
    {
      return $this->valid;
    }

    public function rewind()
    {
      reset($this->data);
      $this->valid = !!count($this->data);
    }

    public function __construct(array $data)
    {
      $this->data = $data;
    }<commit_msg>Fixing bug in just an iterator's valid return.<commit_after><?php
/**
 * Created by PhpStorm.
 * User: rgladson
 * Date: 4/8/2016
 * Time: 11:18 AM
 */
// All errors on
namespace {
  error_reporting(E_ALL);
}
// Load the autoload file.
namespace {
  $autoloader = __DIR__ . '/vendor/autoload.php';
  if (!file_exists($autoloader)) {
    echo "Composer autoloader not found: $autoloader" . PHP_EOL;
    echo "Please issue 'composer install' and try again." . PHP_EOL;
    exit(1);
  }
  require $autoloader;
}


// Define some dummy test functions that can be shared
namespace tests\PHPixme {

  use PHPixme\AssertTypeTrait;
  use PHPixme\ClosedTrait;
  const Closure = \Closure::class;
  // To reduce the amount of pain caused by using reflection if there is a refactor.
  const shortName = 'shortName';

  const doNotRun = __NAMESPACE__ . '\doNotRun';
  function doNotRun()
  {
    throw new \Exception('Callback should of not ran.');
  }

  const noop = __NAMESPACE__ . '\noop';
  function noop()
  {
    // This space is intentionally left blank
  }

  function getArgs()
  {
    return func_get_args();
  }

  class AssertTypeStub
  {
    use AssertTypeTrait;
  }

  /**
   * Class CloseTypeStub
   * @property void $exceptionFoo
   * @package tests\PHPixme
   */
  class CloseTypeStub
  {
    use ClosedTrait;
  }

  class TestClass
  {
    public $value = true;

    static public function testStatic()
    {
      return func_get_args();
    }

    public function getArgs()
    {
      return func_get_args();
    }

    public function countArgs()
    {
      return func_num_args();
    }
  }

  class invokable
  {
    public function __invoke($x)
    {
      return $x;
    }
  }

  class JustAIterator implements \Iterator
  {
    private $data = [];

    public function current()
    {
      return current($this->data);
    }

    public function next()
    {
      next($this->data);
    }

    public function key()
    {
      return key($this->data);
    }

    public function valid()
    {
      return null === key($this->data);
    }

    public function rewind()
    {
      reset($this->data);
    }

    public function __construct(array $data)
    {
      $this->data = $data;
    }
{'fraction_non_alphanumeric': 0.11523830834638622, 'fraction_numerical': 0.0049228015215931975, 'mean_word_length': 2.441108545034642, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '558862', 'n_tokens_mistral': 1517, 'n_tokens_neox': 1462, 'n_words': 391}