diff options
author | Emiel Molenaar <emiel.molenaar@gmail.com> | 2016-02-23 12:33:45 +0100 |
---|---|---|
committer | Emiel Molenaar <emiel.molenaar@gmail.com> | 2016-02-23 12:33:45 +0100 |
commit | 788acada3afa82c1c8fc36a0ad684cfc0c423144 (patch) | |
tree | 9b8e3594044eccd217babfa0edf3de568e0501af | |
parent | a03ea39d284c5ca4c9398029e98ea82d0b146f87 (diff) | |
download | php-terminal-gameboy-emulator-788acada3afa82c1c8fc36a0ad684cfc0c423144.zip php-terminal-gameboy-emulator-788acada3afa82c1c8fc36a0ad684cfc0c423144.tar.gz php-terminal-gameboy-emulator-788acada3afa82c1c8fc36a0ad684cfc0c423144.tar.bz2 |
Add vendor/ to .gitignore (and remove vendor/), add composer.lock to the repository.
31 files changed, 75 insertions, 1856 deletions
@@ -1 +1,2 @@ -material/
\ No newline at end of file +material/ +vendor/ diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..5e1e806 --- /dev/null +++ b/composer.lock @@ -0,0 +1,73 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "86366dfab291cc63b913e9fd405622b8", + "content-hash": "9d3f3f2a6403b572b1354b63d683c63a", + "packages": [ + { + "name": "whatthejeff/drawille", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/whatthejeff/php-drawille.git", + "reference": "bafea427f5bf2445413f6807000a95f70cc83bfd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/whatthejeff/php-drawille/zipball/bafea427f5bf2445413f6807000a95f70cc83bfd", + "reference": "bafea427f5bf2445413f6807000a95f70cc83bfd", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "4.1.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Drawille": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + } + ], + "description": "Terminal drawing with braille", + "homepage": "http://github.com/whatthejeff/php-drawille", + "keywords": [ + "Turtle", + "braille", + "console", + "drawing", + "terminal" + ], + "time": "2014-05-26 13:45:31" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.4.0" + }, + "platform-dev": [] +} diff --git a/vendor/autoload.php b/vendor/autoload.php deleted file mode 100644 index e2e5709..0000000 --- a/vendor/autoload.php +++ /dev/null @@ -1,7 +0,0 @@ -<?php - -// autoload.php @generated by Composer - -require_once __DIR__ . '/composer' . '/autoload_real.php'; - -return ComposerAutoloaderInitb66537925b69007c00fd3869eccc298b::getLoader(); diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php deleted file mode 100644 index ff6ecfb..0000000 --- a/vendor/composer/ClassLoader.php +++ /dev/null @@ -1,413 +0,0 @@ -<?php - -/* - * This file is part of Composer. - * - * (c) Nils Adermann <naderman@naderman.de> - * Jordi Boggiano <j.boggiano@seld.be> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Composer\Autoload; - -/** - * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. - * - * $loader = new \Composer\Autoload\ClassLoader(); - * - * // register classes with namespaces - * $loader->add('Symfony\Component', __DIR__.'/component'); - * $loader->add('Symfony', __DIR__.'/framework'); - * - * // activate the autoloader - * $loader->register(); - * - * // to enable searching the include path (eg. for PEAR packages) - * $loader->setUseIncludePath(true); - * - * In this example, if you try to use a class in the Symfony\Component - * namespace or one of its children (Symfony\Component\Console for instance), - * the autoloader will first look for the class under the component/ - * directory, and it will then fallback to the framework/ directory if not - * found before giving up. - * - * This class is loosely based on the Symfony UniversalClassLoader. - * - * @author Fabien Potencier <fabien@symfony.com> - * @author Jordi Boggiano <j.boggiano@seld.be> - * @see http://www.php-fig.org/psr/psr-0/ - * @see http://www.php-fig.org/psr/psr-4/ - */ -class ClassLoader -{ - // PSR-4 - private $prefixLengthsPsr4 = array(); - private $prefixDirsPsr4 = array(); - private $fallbackDirsPsr4 = array(); - - // PSR-0 - private $prefixesPsr0 = array(); - private $fallbackDirsPsr0 = array(); - - private $useIncludePath = false; - private $classMap = array(); - - private $classMapAuthoritative = false; - - public function getPrefixes() - { - if (!empty($this->prefixesPsr0)) { - return call_user_func_array('array_merge', $this->prefixesPsr0); - } - - return array(); - } - - public function getPrefixesPsr4() - { - return $this->prefixDirsPsr4; - } - - public function getFallbackDirs() - { - return $this->fallbackDirsPsr0; - } - - public function getFallbackDirsPsr4() - { - return $this->fallbackDirsPsr4; - } - - public function getClassMap() - { - return $this->classMap; - } - - /** - * @param array $classMap Class to filename map - */ - public function addClassMap(array $classMap) - { - if ($this->classMap) { - $this->classMap = array_merge($this->classMap, $classMap); - } else { - $this->classMap = $classMap; - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, either - * appending or prepending to the ones previously set for this prefix. - * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories - */ - public function add($prefix, $paths, $prepend = false) - { - if (!$prefix) { - if ($prepend) { - $this->fallbackDirsPsr0 = array_merge( - (array) $paths, - $this->fallbackDirsPsr0 - ); - } else { - $this->fallbackDirsPsr0 = array_merge( - $this->fallbackDirsPsr0, - (array) $paths - ); - } - - return; - } - - $first = $prefix[0]; - if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = (array) $paths; - - return; - } - if ($prepend) { - $this->prefixesPsr0[$first][$prefix] = array_merge( - (array) $paths, - $this->prefixesPsr0[$first][$prefix] - ); - } else { - $this->prefixesPsr0[$first][$prefix] = array_merge( - $this->prefixesPsr0[$first][$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, either - * appending or prepending to the ones previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories - * - * @throws \InvalidArgumentException - */ - public function addPsr4($prefix, $paths, $prepend = false) - { - if (!$prefix) { - // Register directories for the root namespace. - if ($prepend) { - $this->fallbackDirsPsr4 = array_merge( - (array) $paths, - $this->fallbackDirsPsr4 - ); - } else { - $this->fallbackDirsPsr4 = array_merge( - $this->fallbackDirsPsr4, - (array) $paths - ); - } - } elseif (!isset($this->prefixDirsPsr4[$prefix])) { - // Register directories for a new namespace. - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } elseif ($prepend) { - // Prepend directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - (array) $paths, - $this->prefixDirsPsr4[$prefix] - ); - } else { - // Append directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - $this->prefixDirsPsr4[$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, - * replacing any others previously set for this prefix. - * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 base directories - */ - public function set($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr0 = (array) $paths; - } else { - $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, - * replacing any others previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories - * - * @throws \InvalidArgumentException - */ - public function setPsr4($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr4 = (array) $paths; - } else { - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } - } - - /** - * Turns on searching the include path for class files. - * - * @param bool $useIncludePath - */ - public function setUseIncludePath($useIncludePath) - { - $this->useIncludePath = $useIncludePath; - } - - /** - * Can be used to check if the autoloader uses the include path to check - * for classes. - * - * @return bool - */ - public function getUseIncludePath() - { - return $this->useIncludePath; - } - - /** - * Turns off searching the prefix and fallback directories for classes - * that have not been registered with the class map. - * - * @param bool $classMapAuthoritative - */ - public function setClassMapAuthoritative($classMapAuthoritative) - { - $this->classMapAuthoritative = $classMapAuthoritative; - } - - /** - * Should class lookup fail if not found in the current class map? - * - * @return bool - */ - public function isClassMapAuthoritative() - { - return $this->classMapAuthoritative; - } - - /** - * Registers this instance as an autoloader. - * - * @param bool $prepend Whether to prepend the autoloader or not - */ - public function register($prepend = false) - { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); - } - - /** - * Unregisters this instance as an autoloader. - */ - public function unregister() - { - spl_autoload_unregister(array($this, 'loadClass')); - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - * @return bool|null True if loaded, null otherwise - */ - public function loadClass($class) - { - if ($file = $this->findFile($class)) { - includeFile($file); - - return true; - } - } - - /** - * Finds the path to the file where the class is defined. - * - * @param string $class The name of the class - * - * @return string|false The path if found, false otherwise - */ - public function findFile($class) - { - // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731 - if ('\\' == $class[0]) { - $class = substr($class, 1); - } - - // class map lookup - if (isset($this->classMap[$class])) { - return $this->classMap[$class]; - } - if ($this->classMapAuthoritative) { - return false; - } - - $file = $this->findFileWithExtension($class, '.php'); - - // Search for Hack files if we are running on HHVM - if ($file === null && defined('HHVM_VERSION')) { - $file = $this->findFileWithExtension($class, '.hh'); - } - - if ($file === null) { - // Remember that this class does not exist. - return $this->classMap[$class] = false; - } - - return $file; - } - - private function findFileWithExtension($class, $ext) - { - // PSR-4 lookup - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; - - $first = $class[0]; - if (isset($this->prefixLengthsPsr4[$first])) { - foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { - if (0 === strpos($class, $prefix)) { - foreach ($this->prefixDirsPsr4[$prefix] as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { - return $file; - } - } - } - } - } - - // PSR-4 fallback dirs - foreach ($this->fallbackDirsPsr4 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { - return $file; - } - } - - // PSR-0 lookup - if (false !== $pos = strrpos($class, '\\')) { - // namespaced class name - $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) - . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); - } else { - // PEAR-like class name - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; - } - - if (isset($this->prefixesPsr0[$first])) { - foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { - if (0 === strpos($class, $prefix)) { - foreach ($dirs as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - } - } - } - - // PSR-0 fallback dirs - foreach ($this->fallbackDirsPsr0 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - - // PSR-0 include paths. - if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { - return $file; - } - } -} - -/** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - */ -function includeFile($file) -{ - include $file; -} diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE deleted file mode 100644 index c8d57af..0000000 --- a/vendor/composer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - -Copyright (c) 2015 Nils Adermann, Jordi Boggiano - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php deleted file mode 100644 index 7a91153..0000000 --- a/vendor/composer/autoload_classmap.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -// autoload_classmap.php @generated by Composer - -$vendorDir = dirname(dirname(__FILE__)); -$baseDir = dirname($vendorDir); - -return array( -); diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php deleted file mode 100644 index e6d077a..0000000 --- a/vendor/composer/autoload_namespaces.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -// autoload_namespaces.php @generated by Composer - -$vendorDir = dirname(dirname(__FILE__)); -$baseDir = dirname($vendorDir); - -return array( - 'GameBoy' => array($baseDir . '/src'), - 'Drawille' => array($vendorDir . '/whatthejeff/drawille/src'), -); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php deleted file mode 100644 index b265c64..0000000 --- a/vendor/composer/autoload_psr4.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -// autoload_psr4.php @generated by Composer - -$vendorDir = dirname(dirname(__FILE__)); -$baseDir = dirname($vendorDir); - -return array( -); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php deleted file mode 100644 index f25776e..0000000 --- a/vendor/composer/autoload_real.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php - -// autoload_real.php @generated by Composer - -class ComposerAutoloaderInitb66537925b69007c00fd3869eccc298b -{ - private static $loader; - - public static function loadClassLoader($class) - { - if ('Composer\Autoload\ClassLoader' === $class) { - require __DIR__ . '/ClassLoader.php'; - } - } - - public static function getLoader() - { - if (null !== self::$loader) { - return self::$loader; - } - - spl_autoload_register(array('ComposerAutoloaderInitb66537925b69007c00fd3869eccc298b', 'loadClassLoader'), true, true); - self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInitb66537925b69007c00fd3869eccc298b', 'loadClassLoader')); - - $map = require __DIR__ . '/autoload_namespaces.php'; - foreach ($map as $namespace => $path) { - $loader->set($namespace, $path); - } - - $map = require __DIR__ . '/autoload_psr4.php'; - foreach ($map as $namespace => $path) { - $loader->setPsr4($namespace, $path); - } - - $classMap = require __DIR__ . '/autoload_classmap.php'; - if ($classMap) { - $loader->addClassMap($classMap); - } - - $loader->register(true); - - return $loader; - } -} diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json deleted file mode 100644 index 7f62f30..0000000 --- a/vendor/composer/installed.json +++ /dev/null @@ -1,56 +0,0 @@ -[ - { - "name": "whatthejeff/drawille", - "version": "v1.0.1", - "version_normalized": "1.0.1.0", - "source": { - "type": "git", - "url": "https://github.com/whatthejeff/php-drawille.git", - "reference": "bafea427f5bf2445413f6807000a95f70cc83bfd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/whatthejeff/php-drawille/zipball/bafea427f5bf2445413f6807000a95f70cc83bfd", - "reference": "bafea427f5bf2445413f6807000a95f70cc83bfd", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "4.1.*" - }, - "time": "2014-05-26 13:45:31", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "Drawille": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - } - ], - "description": "Terminal drawing with braille", - "homepage": "http://github.com/whatthejeff/php-drawille", - "keywords": [ - "Turtle", - "braille", - "console", - "drawing", - "terminal" - ] - } -] diff --git a/vendor/whatthejeff/drawille/.gitignore b/vendor/whatthejeff/drawille/.gitignore deleted file mode 100644 index c776adf..0000000 --- a/vendor/whatthejeff/drawille/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -composer.lock -composer.phar -phpunit.xml -vendor
\ No newline at end of file diff --git a/vendor/whatthejeff/drawille/.travis.yml b/vendor/whatthejeff/drawille/.travis.yml deleted file mode 100644 index dc2a600..0000000 --- a/vendor/whatthejeff/drawille/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: php - -php: - - 5.4 - - 5.5 - - 5.6 - - hhvm - -before_script: - - composer install --prefer-source - -script: vendor/bin/phpunit
\ No newline at end of file diff --git a/vendor/whatthejeff/drawille/ChangeLog.md b/vendor/whatthejeff/drawille/ChangeLog.md deleted file mode 100644 index 5076a92..0000000 --- a/vendor/whatthejeff/drawille/ChangeLog.md +++ /dev/null @@ -1,13 +0,0 @@ -ChangeLog -========= - -1.0.1 ------ - -* Fixed notice. -* Added more examples. - -1.0.0 ------ - -* It begins!
\ No newline at end of file diff --git a/vendor/whatthejeff/drawille/LICENSE b/vendor/whatthejeff/drawille/LICENSE deleted file mode 100644 index 96938ca..0000000 --- a/vendor/whatthejeff/drawille/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2014 Jeff Welch - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE.
\ No newline at end of file diff --git a/vendor/whatthejeff/drawille/README.md b/vendor/whatthejeff/drawille/README.md deleted file mode 100644 index 57b3c88..0000000 --- a/vendor/whatthejeff/drawille/README.md +++ /dev/null @@ -1,76 +0,0 @@ -php-drawille -============ - -Terminal drawing with [braille](http://en.wikipedia.org/wiki/Braille). - - - -## Requirements - -php-drawille requires PHP 5.4.0 or later. - -## Installation - -The recommended way to install php-drawille is [through -composer](http://getcomposer.org). Just create a `composer.json` file and -run the `php composer.phar install` command to install it: - -~~~json -{ - "require": { - "whatthejeff/drawille": "~1.0" - } -} -~~~ - -## Usage - -~~~php -use Drawille\Canvas; - -$canvas = new Canvas(); - -for($x = 0; $x <= 1800; $x += 10) { - $canvas->set($x / 10, 10 + sin($x * M_PI / 180) * 10); -} - -echo $canvas->frame(), "\n"; -~~~ - - - -~~~php -use Drawille\Turtle; - -$turtle = new Turtle(); - -for($x = 0; $x < 36; $x++) { - $turtle->right(10); - - for($y = 0; $y < 36; $y++) { - $turtle->right(10); - $turtle->forward(8); - } -} - -echo $turtle->frame(), "\n"; -~~~ - - - -## Tests - -[](https://travis-ci.org/whatthejeff/php-drawille) - -To run the test suite, you need [composer](http://getcomposer.org). - - $ php composer.phar install - $ vendor/bin/phpunit - -## Acknowledgements - -php-drawille is a port of [drawille](https://github.com/asciimoo/drawille). - -## License - -php-drawille is licensed under the [MIT license](LICENSE).
\ No newline at end of file diff --git a/vendor/whatthejeff/drawille/composer.json b/vendor/whatthejeff/drawille/composer.json deleted file mode 100644 index f07bf1a..0000000 --- a/vendor/whatthejeff/drawille/composer.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "whatthejeff/drawille", - "description": "Terminal drawing with braille", - "keywords": ["terminal","console","braille","drawing","turtle"], - "homepage": "http://github.com/whatthejeff/php-drawille", - "license": "MIT", - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - } - ], - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "4.1.*" - }, - "autoload": { - "psr-0": { - "Drawille": "src/" - } - }, - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - } -}
\ No newline at end of file diff --git a/vendor/whatthejeff/drawille/docs/images/octocat.png b/vendor/whatthejeff/drawille/docs/images/octocat.png Binary files differdeleted file mode 100644 index af8d6ec..0000000 --- a/vendor/whatthejeff/drawille/docs/images/octocat.png +++ /dev/null diff --git a/vendor/whatthejeff/drawille/docs/images/sin.png b/vendor/whatthejeff/drawille/docs/images/sin.png Binary files differdeleted file mode 100644 index 22262bd..0000000 --- a/vendor/whatthejeff/drawille/docs/images/sin.png +++ /dev/null diff --git a/vendor/whatthejeff/drawille/docs/images/turtle.png b/vendor/whatthejeff/drawille/docs/images/turtle.png Binary files differdeleted file mode 100644 index 8ae6822..0000000 --- a/vendor/whatthejeff/drawille/docs/images/turtle.png +++ /dev/null diff --git a/vendor/whatthejeff/drawille/examples/ImagePrinter.php b/vendor/whatthejeff/drawille/examples/ImagePrinter.php deleted file mode 100644 index d01ed67..0000000 --- a/vendor/whatthejeff/drawille/examples/ImagePrinter.php +++ /dev/null @@ -1,76 +0,0 @@ -<?php - -/* - * This file is part of php-drawille - * - * (c) Jeff Welch <whatthejeff@gmail.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use Imagine\Gd\Imagine; -use Imagine\Image\Box; -use Imagine\Image\Point; - -use Drawille\Canvas; - -class ImagePrinter -{ - private $image; - private $threshold; - private $ratio; - private $invert; - - public function __construct($image, $threshold = 385.2, $ratio = null, $invert = false) { - $this->image = $image; - $this->threshold = (float) $threshold; - $this->ratio = $ratio; - $this->invert = $invert; - } - - public function run($terminalWidth, $terminalHeight) { - $imagine = new Imagine(); - $image = $imagine->open($this->image); - - $size = $image->getSize(); - $width = $size->getWidth(); - $height = $size->getHeight(); - - if ($this->ratio) { - $ratio = (float) $this->ratio; - $width = floor($width * $ratio); - $height = floor($height * $ratio); - $image->resize(new Box($width, $height)); - } - - else { - $height_ratio = $terminalHeight * 4 / $height; - $width_ratio = $terminalWidth * 2 / $width; - $ratio = min($height_ratio, $width_ratio); - - if ($ratio < 1.0) { - $width = floor($width * $ratio); - $height = floor($height * $ratio); - $image->resize(new Box($width, $height)); - } - } - - $canvas = new Canvas(); - - for ($y = 0; $y < $height; $y++) { - for ($x = 0; $x < $width; $x++) { - $color = $image->getColorAt(new Point($x, $y)); - $total = $color->getRed() + $color->getGreen() + $color->getBlue(); - - if (!$this->invert ^ $total > $this->threshold) { - $canvas->set($x, $y); - } - } - } - - echo $canvas->frame(), "\n"; - } -} - -?>
\ No newline at end of file diff --git a/vendor/whatthejeff/drawille/examples/basic.php b/vendor/whatthejeff/drawille/examples/basic.php deleted file mode 100644 index a4835c9..0000000 --- a/vendor/whatthejeff/drawille/examples/basic.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php - -/* - * This file is part of php-drawille - * - * (c) Jeff Welch <whatthejeff@gmail.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once __DIR__ . '/../vendor/autoload.php'; - -use Drawille\Canvas; - -$canvas = new Canvas(); - -for ($x = 0; $x <= 1800; $x++) { - $canvas->set($x / 10, sin($x * M_PI / 180) * 10); -} - -echo $canvas->frame(), "\n"; -$canvas->clear(); - -for ($x = 0; $x <= 1800; $x += 10) { - $canvas->set($x / 10, 10 + sin($x * M_PI / 180) * 10); - $canvas->set($x / 10, 10 + cos($x * M_PI / 180) * 10); -} - -echo $canvas->frame(), "\n"; -$canvas->clear(); - -for ($x = 0; $x <= 3600; $x += 20) { - $canvas->set($x / 20, 4 + sin($x * M_PI / 180) * 4); -} - -echo $canvas->frame(), "\n"; -$canvas->clear(); - -for ($x = 0; $x <= 360; $x += 4) { - $canvas->set($x / 4, 30 + sin($x * M_PI / 180) * 30); -} - -for ($x = 0; $x <= 30; $x++) { - for ($y = 0; $y <= 30; $y++) { - $canvas->set($x, $y); - $canvas->toggle($x+30, $y+30); - $canvas->toggle($x+60, $y); - } -} - -echo $canvas->frame(), "\n";
\ No newline at end of file diff --git a/vendor/whatthejeff/drawille/examples/composer.json b/vendor/whatthejeff/drawille/examples/composer.json deleted file mode 100644 index ec57a4e..0000000 --- a/vendor/whatthejeff/drawille/examples/composer.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "whatthejeff/drawille-examples", - "description": "drawille examples", - "keywords": ["terminal","console","braille","drawing","xkcd","octocat","image"], - "homepage": "http://github.com/whatthejeff/drawille", - "license": "MIT", - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - } - ], - "require": { - "php": ">=5.4.0", - "imagine/imagine": "~0.5.0", - "symfony/console": "~2.4", - "fabpot/Goutte": "~2.0", - "whatthejeff/drawille": "~1.0", - "ext-gd": "*" - }, - "autoload": { - "psr-0": { - "ImagePrinter": "" - } - }, - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - } -} diff --git a/vendor/whatthejeff/drawille/examples/img2term.php b/vendor/whatthejeff/drawille/examples/img2term.php deleted file mode 100755 index a2eba35..0000000 --- a/vendor/whatthejeff/drawille/examples/img2term.php +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env php -<?php - -/* - * This file is part of php-drawille - * - * (c) Jeff Welch <whatthejeff@gmail.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once __DIR__ . '/vendor/autoload.php'; - -use Symfony\Component\Console\Application as ConsoleApplication; -use Symfony\Component\Console\Command\Command as ConsoleCommand; - -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Input\InputDefinition; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; - -class Application extends ConsoleApplication -{ - public function __construct() { - parent::__construct(basename(__FILE__), '1.0'); - $this->add(new Command); - } - - protected function getCommandName(InputInterface $input) { - return basename(__FILE__); - } - - protected function getDefaultInputDefinition() - { - return new InputDefinition(array( - new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message.'), - new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version.') - )); - } -} - -class Command extends ConsoleCommand -{ - protected function configure() - { - $this->setName(basename(__FILE__)) - ->setDescription('convert an image to terminal') - ->addArgument( - 'image', - InputArgument::REQUIRED, - 'Image file path/url' - ) - ->addOption( - 'threshold', - 't', - InputOption::VALUE_REQUIRED, - 'Color threshold', - 382.5 - ) - ->addOption( - 'ratio', - 'r', - InputOption::VALUE_REQUIRED, - 'Image resize ratio' - ) - ->addOption( - 'invert', - 'i', - InputOption::VALUE_NONE, - 'Invert colors' - ); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - list($terminalWidth, $terminalHeight) = $this->getApplication()->getTerminalDimensions(); - - $printer = new ImagePrinter( - $input->getArgument('image'), - $input->getOption('threshold'), - $input->getOption('ratio'), - $input->getOption('invert') - ); - - $printer->run($terminalWidth, $terminalHeight); - } -} - -$console = new Application(); -$console->run();
\ No newline at end of file diff --git a/vendor/whatthejeff/drawille/examples/octocat2term.php b/vendor/whatthejeff/drawille/examples/octocat2term.php deleted file mode 100755 index 19cfd5b..0000000 --- a/vendor/whatthejeff/drawille/examples/octocat2term.php +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env php -<?php - -/* - * This file is part of php-drawille - * - * (c) Jeff Welch <whatthejeff@gmail.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once __DIR__ . '/vendor/autoload.php'; - -use Symfony\Component\Console\Application as ConsoleApplication; -use Symfony\Component\Console\Command\Command as ConsoleCommand; - -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Input\InputDefinition; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; - -use Goutte\Client; - -class Application extends ConsoleApplication -{ - public function __construct() { - parent::__construct(basename(__FILE__), '1.0'); - $this->add(new Command); - } - - protected function getCommandName(InputInterface $input) { - return basename(__FILE__); - } - - protected function getDefaultInputDefinition() - { - return new InputDefinition(array( - new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message.'), - new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version.') - )); - } -} - -class Command extends ConsoleCommand -{ - protected function configure() - { - $this->setName(basename(__FILE__)) - ->setDescription('convert an octocat to terminal') - ->addArgument( - 'cat', - InputArgument::REQUIRED, - 'Cat number, name, title, or "random"' - ) - ->addOption( - 'threshold', - 't', - InputOption::VALUE_REQUIRED, - 'Color threshold', - 382.5 - ) - ->addOption( - 'ratio', - 'r', - InputOption::VALUE_REQUIRED, - 'Image resize ratio' - ) - ->addOption( - 'invert', - 'i', - InputOption::VALUE_NONE, - 'Invert colors' - ); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $url = 'https://octodex.github.com'; - $cat = $input->getArgument('cat'); - - $client = new Client(); - $crawler = $client->request('GET', $url); - - try { - if (is_numeric($cat) || $cat == 'random') { - $filter = $crawler->filter('.preview-image > img'); - $total = iterator_count($filter); - - if($cat == 'random') { - $cat = mt_rand(1, $total); - } - - $image = $filter->eq($total - $cat)->attr('data-src'); - } - - else if (substr($cat, 0, 4) == 'the ') { - $image = $crawler->filter("img[alt=\"$cat\"]")->attr('data-src'); - } - - else { - $image = $crawler->filter("a[href=\"/$cat\"] > img")->attr('data-src'); - } - } - - catch (InvalidArgumentException $exception) { - throw new RuntimeException('Octocat not found at: ' . $url); - } - - list($terminalWidth, $terminalHeight) = $this->getApplication()->getTerminalDimensions(); - - $printer = new ImagePrinter( - 'https://octodex.github.com' . $image, - $input->getOption('threshold'), - $input->getOption('ratio'), - $input->getOption('invert') - ); - - $printer->run($terminalWidth, $terminalHeight); - } -} - -$console = new Application(); -$console->run();
\ No newline at end of file diff --git a/vendor/whatthejeff/drawille/examples/turtle.php b/vendor/whatthejeff/drawille/examples/turtle.php deleted file mode 100644 index 4f51642..0000000 --- a/vendor/whatthejeff/drawille/examples/turtle.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -/* - * This file is part of php-drawille - * - * (c) Jeff Welch <whatthejeff@gmail.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once __DIR__ . '/../vendor/autoload.php'; - -use Drawille\Turtle; - -$turtle = new Turtle(); - -for ($x = 0; $x < 36; $x++) { - $turtle->right(10); - - for ($y = 0; $y < 36; $y++) { - $turtle->right(10); - $turtle->forward(8); - } -} - -echo $turtle->frame(), "\n";
\ No newline at end of file diff --git a/vendor/whatthejeff/drawille/examples/xkcd2term.php b/vendor/whatthejeff/drawille/examples/xkcd2term.php deleted file mode 100755 index bbd9d82..0000000 --- a/vendor/whatthejeff/drawille/examples/xkcd2term.php +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env php -<?php - -/* - * This file is part of php-drawille - * - * (c) Jeff Welch <whatthejeff@gmail.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once __DIR__ . '/vendor/autoload.php'; - -use Symfony\Component\Console\Application as ConsoleApplication; -use Symfony\Component\Console\Command\Command as ConsoleCommand; - -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Input\InputDefinition; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; - -use Goutte\Client; - -class Application extends ConsoleApplication -{ - public function __construct() { - parent::__construct(basename(__FILE__), '1.0'); - $this->add(new Command); - } - - protected function getCommandName(InputInterface $input) { - return basename(__FILE__); - } - - protected function getDefaultInputDefinition() - { - return new InputDefinition(array( - new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message.'), - new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version.') - )); - } -} - -class Command extends ConsoleCommand -{ - protected function configure() - { - $this->setName(basename(__FILE__)) - ->setDescription('convert an xkcd comic to terminal') - ->addArgument( - 'comic', - InputArgument::REQUIRED, - 'Comic ID or "random"' - ) - ->addOption( - 'threshold', - 't', - InputOption::VALUE_REQUIRED, - 'Color threshold', - 382.5 - ) - ->addOption( - 'ratio', - 'r', - InputOption::VALUE_REQUIRED, - 'Image resize ratio' - ) - ->addOption( - 'invert', - 'i', - InputOption::VALUE_NONE, - 'Invert colors' - ); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $comic = $input->getArgument('comic'); - $url = $comic == 'random' ? 'http://c.xkcd.com/random/comic/' : "http://xkcd.com/$comic/"; - - $client = new Client(); - $crawler = $client->request('GET', $url); - - try { - $image = $crawler->filter('#comic > img')->attr('src'); - } - - catch(InvalidArgumentException $exception) { - throw new RuntimeException('No comic found on: ' . $url); - } - - list($terminalWidth, $terminalHeight) = $this->getApplication()->getTerminalDimensions(); - - $printer = new ImagePrinter( - $image, - $input->getOption('threshold'), - $input->getOption('ratio'), - $input->getOption('invert') - ); - - $printer->run($terminalWidth, $terminalHeight); - } -} - -$console = new Application(); -$console->run();
\ No newline at end of file diff --git a/vendor/whatthejeff/drawille/phpunit.xml.dist b/vendor/whatthejeff/drawille/phpunit.xml.dist deleted file mode 100644 index 37729ba..0000000 --- a/vendor/whatthejeff/drawille/phpunit.xml.dist +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd" - backupGlobals="false" - verbose="true"> - <testsuite name="Drawille"> - <directory suffix="Test.php">tests</directory> - </testsuite> -</phpunit> diff --git a/vendor/whatthejeff/drawille/src/Drawille/Canvas.php b/vendor/whatthejeff/drawille/src/Drawille/Canvas.php deleted file mode 100644 index 0defc86..0000000 --- a/vendor/whatthejeff/drawille/src/Drawille/Canvas.php +++ /dev/null @@ -1,237 +0,0 @@ -<?php - -/* - * This file is part of php-drawille - * - * (c) Jeff Welch <whatthejeff@gmail.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Drawille; - -/** - * Pixel surface - * - * @author Jeff Welch <whatthejeff@gmail.com> - */ -class Canvas -{ - /** - * Dots: - * - * ,___, - * |1 4| - * |2 5| - * |3 6| - * |7 8| - * ````` - * - * @var array - * @see http://www.alanwood.net/unicode/braille_patterns.html - */ - private static $pixel_map = [ - [0x01, 0x08], - [0x02, 0x10], - [0x04, 0x20], - [0x40, 0x80] - ]; - - /** - * Braille characters starts at 0x2800 - * - * @var integer - */ - private static $braille_char_offset = 0x2800; - - /** - * Canvas representation - * - * @var array - */ - private $chars = []; - - /** - * Constructor - */ - public function __construct() { - $this->clear(); - } - - /** - * Clears the canvas - */ - public function clear() { - $this->chars = []; - } - - /** - * Sets a pixel at the given position - * - * @param integer $x x position - * @param integer $y y position - */ - public function set($x, $y) { - list($x, $y, $px, $py) = $this->prime($x, $y); - $this->chars[$py][$px] |= $this->getDotFromMap($x, $y); - } - - /** - * Unsets a pixel at the given position - * - * @param integer $x x position - * @param integer $y y position - */ - public function reset($x, $y) { - list($x, $y, $px, $py) = $this->prime($x, $y); - $this->chars[$py][$px] &= ~$this->getDotFromMap($x, $y); - } - - /** - * Gets the pixel state at a given position - * - * @param integer $x x position - * @param integer $y y position - * - * @return bool the pixel state - */ - public function get($x, $y) { - list($x, $y, , , $char) = $this->prime($x, $y); - return (bool)($char & $this->getDotFromMap($x, $y)); - } - - /** - * Toggles the pixel state on/off at a given position - * - * @param integer $x x position - * @param integer $y y position - */ - public function toggle($x, $y) { - $this->get($x, $y) ? $this->reset($x, $y) : $this->set($x, $y); - } - - /** - * Gets a line - * - * @param integer $y y position - * @param array $options options - * - * @return string line - */ - public function row($y, array $options = []) { - $row = isset($this->chars[$y]) ? $this->chars[$y] : []; - - if(!isset($options['min_x']) || !isset($options['max_x'])) { - if(!($keys = array_keys($row))) { - return ''; - } - } - - $min = isset($options['min_x']) ? $options['min_x'] : min($keys); - $max = isset($options['max_x']) ? $options['max_x'] : max($keys); - - return array_reduce(range($min, $max), function ($carry, $item) use ($row) { - return $carry .= $this->toBraille(isset($row[$item]) ? $row[$item] : 0); - }, ''); - } - - /** - * Gets all lines - * - * @param array $options options - * - * @return array line - */ - public function rows(array $options = []) { - if(!isset($options['min_y']) || !isset($options['max_y'])) { - if(!($keys = array_keys($this->chars))) { - return []; - } - } - - $min = isset($options['min_y']) ? $options['min_y'] : min($keys); - $max = isset($options['max_y']) ? $options['max_y'] : max($keys); - - if(!isset($options['min_x']) || !isset($options['max_x'])) { - $flattened = array(); - foreach($this->chars as $key => $char) { - $flattened = array_merge($flattened, array_keys($char)); - } - } - - $options['min_x'] = isset($options['min_x']) ? $options['min_x'] : min($flattened); - $options['max_x'] = isset($options['max_x']) ? $options['max_x'] : max($flattened); - - return array_map(function ($i) use ($options) { - return $this->row($i, $options); - }, range($min, $max)); - } - - /** - * Gets a string representation of the canvas - * - * @param array $options options - * - * @return string representation - */ - public function frame(array $options = []) { - return join("\n", $this->rows($options)); - } - - /** - * Gets the canvas representation. - * - * @return array characters - */ - public function getChars() { - return $this->chars; - } - - /** - * Gets a braille unicode character - * - * @param integer $code character code - * - * @return string braille - */ - private function toBraille($code) { - return html_entity_decode('&#' . (self::$braille_char_offset + $code) . ';', ENT_NOQUOTES, 'UTF-8'); - } - - /** - * Gets a dot from the pixel map. - * - * @param integer $x x position - * @param integer $y y position - * - * @return integer dot - */ - private function getDotFromMap($x, $y) { - $y = $y % 4; - $x = $x % 2; - - return self::$pixel_map[$y < 0 ? 4 + $y : $y][$x < 0 ? 2 + $x : $x]; - } - - /** - * Autovivification for a canvas position. - * - * @param integer $x x position - * @param integer $y y position - * - * @return array - */ - private function prime($x, $y) { - $x = round($x); - $y = round($y); - $px = floor($x / 2); - $py = floor($y / 4); - - if(!isset($this->chars[$py][$px])) { - $this->chars[$py][$px] = 0; - } - - return [$x, $y, $px, $py, $this->chars[$py][$px]]; - } -}
\ No newline at end of file diff --git a/vendor/whatthejeff/drawille/src/Drawille/Turtle.php b/vendor/whatthejeff/drawille/src/Drawille/Turtle.php deleted file mode 100644 index 542d593..0000000 --- a/vendor/whatthejeff/drawille/src/Drawille/Turtle.php +++ /dev/null @@ -1,242 +0,0 @@ -<?php - -/* - * This file is part of php-drawille - * - * (c) Jeff Welch <whatthejeff@gmail.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Drawille; - -/** - * Basic turtle graphics interface - * - * @author Jeff Welch <whatthejeff@gmail.com> - * @see http://en.wikipedia.org/wiki/Turtle_graphics - */ -class Turtle extends Canvas -{ - /** - * Current x position - * - * @var integer - */ - private $x = 0; - /** - * Current y position - * - * @var integer - */ - private $y = 0; - /** - * Current canvas rotation - * - * @var integer - */ - private $rotation = 0; - - /** - * If the pen is up - * - * @var boolean - */ - private $up = false; - - /** - * Constructor - * - * @param int $y starting x position - * @param int $y starting y position - */ - public function __construct($x = 0, $y = 0) { - parent::__construct(); - - $this->x = $x; - $this->y = $y; - } - - /** - * Gets the current x position. - * - * @return integer x position - */ - public function getX() { - return $this->x; - } - - /** - * Gets the current y position. - * - * @return integer y position - */ - public function getY() { - return $this->y; - } - - /** - * Gets the current canvas rotation - * - * @return integer current canvas rotation - */ - public function getRotation() { - return $this->rotation; - } - - /** - * Push the pen down - */ - public function down() { - $this->up = false; - } - - /** - * Pull the pen up - */ - public function up() { - $this->up = true; - } - - /** - * Move the pen forward - * - * @param integer $length distance to move forward - */ - public function forward($length) { - $theta = $this->rotation / 180.0 * M_PI; - $x = $this->x + $length * cos($theta); - $y = $this->y + $length * sin($theta); - - $this->move($x, $y); - } - - /** - * Move the pen backwards - * - * @param integer $length distance to move backwards - */ - public function back($length) { - $this->forward(-$length); - } - - /** - * Angle the canvas to the right. - * - * @param integer $angle degree to angle - */ - public function right($angle) { - $this->rotation += $angle; - } - - /** - * Angle the canvas to the left. - * - * @param integer $angle degree to angle - */ - public function left($angle) { - $this->rotation -= $angle; - } - - /** - * Move the pen, drawing if the pen is down. - * - * @param int $y new x position - * @param int $y new y position - */ - public function move($x, $y) { - if(!$this->up) { - $x1 = round($this->x); - $y1 = round($this->y); - $x2 = $x; - $y2 = $y; - - $xdiff = max($x1, $x2) - min($x1, $x2); - $ydiff = max($y1, $y2) - min($y1, $y2); - - $xdir = $x1 <= $x2 ? 1 : -1; - $ydir = $y1 <= $y2 ? 1 : -1; - - $r = max($xdiff, $ydiff); - - for($i = 0; $i <= $r; $i++) { - $x = $x1; - $y = $y1; - - if ($ydiff > 0) { - $y += ((float)$i*$ydiff)/$r*$ydir; - } - - if($xdiff > 0) { - $x += ((float)$i*$xdiff)/$r*$xdir; - } - - $this->set($x, $y); - } - } - - $this->x = $x; - $this->y = $y; - } - - /** - * Pull the pen up - */ - public function pu() { - $this->up(); - } - - /** - * Push the pen up - */ - public function pd() { - $this->down(); - } - - /** - * Move the pen forward - * - * @param integer $length distance to move forward - */ - public function fd($length) { - $this->forward($length); - } - - /** - * Move the pen, drawing if the pen is down. - * - * @param int $y new x position - * @param int $y new y position - */ - public function mv($x, $y) { - $this->move($x, $y); - } - - /** - * Angle the canvas to the right. - * - * @param integer $angle degree to angle - */ - public function rt($angle) { - $this->right($angle); - } - - /** - * Angle the canvas to the left. - * - * @param integer $angle degree to angle - */ - public function lt($angle) { - $this->left($angle); - } - - /** - * Move the pen backwards - * - * @param integer $length distance to move backwards - */ - public function bk($length) { - $this->back($length); - } -}
\ No newline at end of file diff --git a/vendor/whatthejeff/drawille/tests/Drawille/CanvasTest.php b/vendor/whatthejeff/drawille/tests/Drawille/CanvasTest.php deleted file mode 100644 index 8ab9537..0000000 --- a/vendor/whatthejeff/drawille/tests/Drawille/CanvasTest.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php - -/* - * This file is part of php-drawille - * - * (c) Jeff Welch <whatthejeff@gmail.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Drawille; - -class CanvasTest extends \PHPUnit_Framework_TestCase -{ - private $canvas; - - protected function setUp() { - $this->canvas = new Canvas(); - } - - public function testSet() { - $this->canvas->set(0, 0); - $this->assertEquals([[1]], $this->canvas->getChars()); - } - - /** - * @depends testSet - */ - public function testReset() { - $this->canvas->set(0, 0); - $this->canvas->reset(0, 0); - $this->assertEquals([[0]], $this->canvas->getChars()); - } - - /** - * @depends testSet - */ - public function testClear() { - $this->canvas->set(0, 0); - $this->canvas->clear(); - $this->assertEmpty($this->canvas->getChars()); - } - - public function testToggle() { - $this->canvas->toggle(0, 0); - $this->assertEquals([[1]], $this->canvas->getChars()); - - $this->canvas->toggle(0, 0); - $this->assertEquals([[0]], $this->canvas->getChars()); - } - - /** - * @depends testSet - */ - public function testFrame() { - $this->assertEquals($this->canvas->frame(), ''); - - $this->canvas->set(0, 0); - $this->assertEquals($this->canvas->frame(), '⠁'); - } - - /** - * @depends testSet - */ - public function testGet() { - $this->assertFalse($this->canvas->get(0, 0)); - $this->canvas->set(0, 0); - - $this->assertTrue($this->canvas->get(0, 0)); - $this->assertFalse($this->canvas->get(1, 0)); - $this->assertFalse($this->canvas->get(0, 1)); - $this->assertFalse($this->canvas->get(1, 1)); - } -}
\ No newline at end of file diff --git a/vendor/whatthejeff/drawille/tests/Drawille/TurtleTest.php b/vendor/whatthejeff/drawille/tests/Drawille/TurtleTest.php deleted file mode 100644 index 40c800b..0000000 --- a/vendor/whatthejeff/drawille/tests/Drawille/TurtleTest.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php - -/* - * This file is part of php-drawille - * - * (c) Jeff Welch <whatthejeff@gmail.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Drawille; - -class TurtleTest extends \PHPUnit_Framework_TestCase -{ - private $turtle; - - protected function setUp() { - $this->turtle = new Turtle(); - } - - public function testPosition() { - $this->assertEquals(0, $this->turtle->getX()); - $this->assertEquals(0, $this->turtle->getY()); - - $this->turtle->move(1, 2); - $this->assertEquals(1, $this->turtle->getX()); - $this->assertEquals(2, $this->turtle->getY()); - } - - public function testRotation() { - $this->assertEquals(0, $this->turtle->getRotation()); - - $this->turtle->right(30); - $this->assertEquals(30, $this->turtle->getRotation()); - - - $this->turtle->left(30); - $this->assertEquals(0, $this->turtle->getRotation()); - } - - public function testBrush() { - $this->assertFalse($this->turtle->get($this->turtle->getX(), $this->turtle->getY())); - - $this->turtle->forward(1); - $this->assertTrue($this->turtle->get(0, 0)); - $this->assertTrue($this->turtle->get($this->turtle->getX(), $this->turtle->getY())); - - $this->turtle->up(); - $this->turtle->move(2, 0); - $this->assertFalse($this->turtle->get($this->turtle->getX(), $this->turtle->getY())); - - $this->turtle->down(); - $this->turtle->move(3, 0); - $this->assertTrue($this->turtle->get($this->turtle->getX(), $this->turtle->getY())); - } -}
\ No newline at end of file |