diff --git a/.gitattributes b/.gitattributes index fe03227..942d538 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,4 @@ /tests export-ignore -/src/Exception export-ignore .gitattributes export-ignore .gitignore export-ignore CHANGELOG.md export-ignore diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c2d8f2..23f1e46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # CHANGELOG +## 1.1.2 - 2017-07-16 +* Deleted `Josantonius\MimeType\Exception\MimeTypeException` class. +* Deleted `Josantonius\MimeType\Exception\Exceptions` abstract class. +* Deleted `Josantonius\MimeType\Exception\MimeTypeException->__construct()` method. + ## 1.1.1 - 2017-03-18 * Some files were excluded from download and comments and readme files were updated. diff --git a/README-ES.md b/README-ES.md index 34d9f8a..72a8bc3 100644 --- a/README-ES.md +++ b/README-ES.md @@ -14,7 +14,6 @@ Librería PHP para obtener encabezados MIME y extensiones a partir de ellos. - [Métodos disponibles](#métodos-disponibles) - [Uso](#uso) - [Tests](#tests) -- [Manejador de excepciones](#manejador-de-excepciones) - [Contribuir](#contribuir) - [Repositorio](#repositorio) - [Licencia](#licencia) @@ -22,6 +21,16 @@ Librería PHP para obtener encabezados MIME y extensiones a partir de ellos. --- +

Echa un vistazo al código

+ +

+ + + +

+ +--- + ### Instalación La mejor forma de instalar esta extensión es a través de [composer](http://getcomposer.org/download/). @@ -40,7 +49,7 @@ También puedes clonar el repositorio completo con Git: ### Requisitos -Esta ĺibrería es soportada por versiones de PHP 5.6 o superiores y es compatible con versiones de HHVM 3.0 o superiores. +Esta biblioteca es soportada por versiones de PHP 5.6 o superiores y es compatible con versiones de HHVM 3.0 o superiores. ### Cómo empezar y ejemplos @@ -124,9 +133,6 @@ MimeTypeTest::testGetExtensionFromMimeUndefined(); MimeTypeTest::testGetAll(); ``` -### Manejador de excepciones - -Esta librería utiliza [control de excepciones](src/Exception) que puedes personalizar a tu gusto. ### Contribuir 1. Comprobar si hay incidencias abiertas o abrir una nueva para iniciar una discusión en torno a un fallo o función. 1. Bifurca la rama del repositorio en GitHub para iniciar la operación de ajuste. diff --git a/README.md b/README.md index 966010a..202152f 100644 --- a/README.md +++ b/README.md @@ -14,14 +14,23 @@ PHP library for obtain headers MIME. - [Available Methods](#available-methods) - [Usage](#usage) - [Tests](#tests) -- [Exception Handler](#exception-handler) - [Contribute](#contribute) - [Repository](#repository) -- [Licensing](#licensing) +- [License](#license) - [Copyright](#copyright) --- +

Take a look at the code

+ +

+ + + +

+ +--- + ### Installation The preferred way to install this extension is through [composer](http://getcomposer.org/download/). @@ -125,9 +134,6 @@ MimeTypeTest::testGetExtensionFromMimeUndefined(); MimeTypeTest::testGetAll(); ``` -### Exception Handler - -This library uses [exception handler](src/Exception) that you can customize. ### Contribute 1. Check for open issues or open a new issue to start a discussion around a bug or feature. 1. Fork the repository on GitHub to start making your changes. @@ -141,7 +147,7 @@ This is intended for large and long-lived objects. All files in this repository were created and uploaded automatically with [Reposgit Creator](https://github.com/Josantonius/BASH-Reposgit). -### Licensing +### License This project is licensed under **MIT license**. See the [LICENSE](LICENSE) file for more info. diff --git a/composer.json b/composer.json index 446a6a5..24f990b 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "josantonius/mimetype", - "version": "1.1.1", + "version": "1.1.2", "type": "library", "description": "PHP library for obtain headers MIME.", "keywords": [ diff --git a/src/MimeType.php b/src/MimeType.php index 96d16f9..1755e15 100644 --- a/src/MimeType.php +++ b/src/MimeType.php @@ -11,8 +11,6 @@ namespace Josantonius\MimeType; -# use Josantonius\MimeType\Exception\MimeTypeException; - /** * Get MIME type and file extensions. * @@ -38,20 +36,20 @@ class MimeType { */ protected static function load() { - if (is_null(static::$mimeTypes)) { + if (is_null(self::$mimeTypes)) { - $filepath = __DIR__ . "/resources/mimeTypes.jsond"; + $filepath = __DIR__ . '/resources/mimeTypes.jsond'; $jsonFile = file_get_contents($filepath); $mimeTypes = json_decode($jsonFile, true); - static::$mimeTypes = $mimeTypes['data']; + self::$mimeTypes = $mimeTypes['data']; unset($mimeTypes); } - return static::$mimeTypes; + return self::$mimeTypes; } /** @@ -59,16 +57,16 @@ protected static function load() { * * @since 1.0.0 * - * @param string $ext → file extension, e.g. ".html" + * @param string $ext → file extension, e.g. '.html' * * @throws MimeTypeException → file extension not found * @return string → MIME type */ public static function getMimeFromExtension($ext) { - static::load(); + self::load(); - return (isset(static::$mimeTypes[$ext]) ? static::$mimeTypes[$ext] : "undefined"); + return (isset(self::$mimeTypes[$ext]) ? self::$mimeTypes[$ext] : 'undefined'); } /** @@ -76,21 +74,21 @@ public static function getMimeFromExtension($ext) { * * @since 1.0.0 * - * @param string $mime → MIME type, e.g. "text/html" + * @param string $mime → MIME type, e.g. 'text/html' * * @throws MimeTypeException → MIME type not found * @return string → file extension */ public static function getExtensionFromMime($mime) { - static::load(); + self::load(); - if ($index = array_search($mime, static::$mimeTypes)) { + if ($index = array_search($mime, self::$mimeTypes)) { return $index; } - return "undefined"; + return 'undefined'; } /** @@ -102,6 +100,6 @@ public static function getExtensionFromMime($mime) { */ public static function getAll() { - return static::load(); + return self::load(); } }