commit
75cb771e4b
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Configuration file for PHP Coding Standards Fixer (php-cs-fixer).
|
||||||
|
*
|
||||||
|
* On GitHub: https://github.com/FriendsOfPhp/php-cs-fixer
|
||||||
|
* More information: http://cs.sensiolabs.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
$finder = Symfony\CS\Finder\DefaultFinder::create()
|
||||||
|
->in('lib')
|
||||||
|
;
|
||||||
|
|
||||||
|
return Symfony\CS\Config\Config::create()
|
||||||
|
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
|
||||||
|
->fixers(['concat_with_spaces', 'long_array_syntax', 'standardize_not_equal',
|
||||||
|
'operators_spaces', 'duplicate_semicolon',
|
||||||
|
'remove_leading_slash_use', 'align_equals',
|
||||||
|
'single_array_no_trailing_comma', 'phpdoc_indent', 'phpdoc_scalar',
|
||||||
|
'phpdoc_to_comment', 'phpdoc_trim',
|
||||||
|
'phpdoc_types', 'print_to_echo', 'self_accessor', 'single_quote',
|
||||||
|
'spaces_cast', 'ternary_spaces', 'phpdoc_order'])
|
||||||
|
->finder($finder)
|
||||||
|
;
|
@ -0,0 +1,858 @@
|
|||||||
|
{
|
||||||
|
"_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": "e3520dc72004bd92b2bd0b0febf71c7f",
|
||||||
|
"content-hash": "ac3ea1f44998ea42345107fd21d6a2e0",
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "yzalis/identicon",
|
||||||
|
"version": "1.1.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/yzalis/Identicon.git",
|
||||||
|
"reference": "a99fc2a3d018512f7914bc6f972952536c0f309b"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/yzalis/Identicon/zipball/a99fc2a3d018512f7914bc6f972952536c0f309b",
|
||||||
|
"reference": "a99fc2a3d018512f7914bc6f972952536c0f309b",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"fzaninotto/faker": "1.2.*@dev"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Identicon": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Benjamin Laugueux",
|
||||||
|
"email": "benjamin@yzalis.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Create awesome unique avatar.",
|
||||||
|
"homepage": "http://identicon-php.org",
|
||||||
|
"keywords": [
|
||||||
|
"avatar",
|
||||||
|
"identicon",
|
||||||
|
"image"
|
||||||
|
],
|
||||||
|
"time": "2014-07-13 09:19:12"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"packages-dev": [
|
||||||
|
{
|
||||||
|
"name": "codacy/coverage",
|
||||||
|
"version": "dev-master",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/codacy/php-codacy-coverage.git",
|
||||||
|
"reference": "92194b1ece3379e56bb1f95d6f540fc6244d9946"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/codacy/php-codacy-coverage/zipball/92194b1ece3379e56bb1f95d6f540fc6244d9946",
|
||||||
|
"reference": "92194b1ece3379e56bb1f95d6f540fc6244d9946",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"gitonomy/gitlib": "~0.1",
|
||||||
|
"php": ">=5.3.3",
|
||||||
|
"symfony/console": "~2.5|~3.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "~4.5"
|
||||||
|
},
|
||||||
|
"bin": [
|
||||||
|
"bin/codacycoverage"
|
||||||
|
],
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"src/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Jakob Pupke",
|
||||||
|
"email": "jakob.pupke@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Sends PHP test coverage information to Codacy.",
|
||||||
|
"homepage": "https://github.com/codacy/php-codacy-coverage",
|
||||||
|
"time": "2016-07-07 15:33:12"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "codeclimate/php-test-reporter",
|
||||||
|
"version": "dev-master",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/codeclimate/php-test-reporter.git",
|
||||||
|
"reference": "68786c391d2b859054046a7b7ed07c64e7b741a1"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/codeclimate/php-test-reporter/zipball/68786c391d2b859054046a7b7ed07c64e7b741a1",
|
||||||
|
"reference": "68786c391d2b859054046a7b7ed07c64e7b741a1",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-curl": "*",
|
||||||
|
"php": ">=5.3",
|
||||||
|
"satooshi/php-coveralls": "^1.0",
|
||||||
|
"symfony/console": "^2.0|^3.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"ext-xdebug": "*",
|
||||||
|
"phpunit/phpunit": "3.7.*@stable",
|
||||||
|
"tm/tooly-composer-script": "^1.0"
|
||||||
|
},
|
||||||
|
"bin": [
|
||||||
|
"composer/bin/test-reporter"
|
||||||
|
],
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "0.3.x-dev"
|
||||||
|
},
|
||||||
|
"tools": {
|
||||||
|
"box": {
|
||||||
|
"url": "https://github.com/box-project/box2/releases/download/2.7.2/box-2.7.2.phar",
|
||||||
|
"only-dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"CodeClimate\\PhpTestReporter\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Code Climate",
|
||||||
|
"email": "hello@codeclimate.com",
|
||||||
|
"homepage": "https://codeclimate.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHP client for reporting test coverage to Code Climate",
|
||||||
|
"homepage": "https://github.com/codeclimate/php-test-reporter",
|
||||||
|
"keywords": [
|
||||||
|
"codeclimate",
|
||||||
|
"coverage"
|
||||||
|
],
|
||||||
|
"time": "2016-08-09 19:41:51"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "gitonomy/gitlib",
|
||||||
|
"version": "v0.1.8",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/gitonomy/gitlib.git",
|
||||||
|
"reference": "f575b8f7da917ade7890c6aa705fa22545690389"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/gitonomy/gitlib/zipball/f575b8f7da917ade7890c6aa705fa22545690389",
|
||||||
|
"reference": "f575b8f7da917ade7890c6aa705fa22545690389",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"symfony/process": "^2.3|^3.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"psr/log": "^1.0"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"psr/log": "Add some log"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.0-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Gitonomy\\Git\\": "src/Gitonomy/Git/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Alexandre Salomé",
|
||||||
|
"email": "alexandre.salome@gmail.com",
|
||||||
|
"homepage": "http://alexandre-salome.fr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Julien DIDIER",
|
||||||
|
"email": "genzo.wm@gmail.com",
|
||||||
|
"homepage": "http://www.jdidier.net"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Library for accessing git",
|
||||||
|
"homepage": "http://gitonomy.com",
|
||||||
|
"time": "2015-12-01 22:25:57"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "guzzle/guzzle",
|
||||||
|
"version": "v3.9.3",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/guzzle/guzzle3.git",
|
||||||
|
"reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/guzzle/guzzle3/zipball/0645b70d953bc1c067bbc8d5bc53194706b628d9",
|
||||||
|
"reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-curl": "*",
|
||||||
|
"php": ">=5.3.3",
|
||||||
|
"symfony/event-dispatcher": "~2.1"
|
||||||
|
},
|
||||||
|
"replace": {
|
||||||
|
"guzzle/batch": "self.version",
|
||||||
|
"guzzle/cache": "self.version",
|
||||||
|
"guzzle/common": "self.version",
|
||||||
|
"guzzle/http": "self.version",
|
||||||
|
"guzzle/inflection": "self.version",
|
||||||
|
"guzzle/iterator": "self.version",
|
||||||
|
"guzzle/log": "self.version",
|
||||||
|
"guzzle/parser": "self.version",
|
||||||
|
"guzzle/plugin": "self.version",
|
||||||
|
"guzzle/plugin-async": "self.version",
|
||||||
|
"guzzle/plugin-backoff": "self.version",
|
||||||
|
"guzzle/plugin-cache": "self.version",
|
||||||
|
"guzzle/plugin-cookie": "self.version",
|
||||||
|
"guzzle/plugin-curlauth": "self.version",
|
||||||
|
"guzzle/plugin-error-response": "self.version",
|
||||||
|
"guzzle/plugin-history": "self.version",
|
||||||
|
"guzzle/plugin-log": "self.version",
|
||||||
|
"guzzle/plugin-md5": "self.version",
|
||||||
|
"guzzle/plugin-mock": "self.version",
|
||||||
|
"guzzle/plugin-oauth": "self.version",
|
||||||
|
"guzzle/service": "self.version",
|
||||||
|
"guzzle/stream": "self.version"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"doctrine/cache": "~1.3",
|
||||||
|
"monolog/monolog": "~1.0",
|
||||||
|
"phpunit/phpunit": "3.7.*",
|
||||||
|
"psr/log": "~1.0",
|
||||||
|
"symfony/class-loader": "~2.1",
|
||||||
|
"zendframework/zend-cache": "2.*,<2.3",
|
||||||
|
"zendframework/zend-log": "2.*,<2.3"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"guzzlehttp/guzzle": "Guzzle 5 has moved to a new package name. The package you have installed, Guzzle 3, is deprecated."
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "3.9-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Guzzle": "src/",
|
||||||
|
"Guzzle\\Tests": "tests/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Michael Dowling",
|
||||||
|
"email": "mtdowling@gmail.com",
|
||||||
|
"homepage": "https://github.com/mtdowling"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Guzzle Community",
|
||||||
|
"homepage": "https://github.com/guzzle/guzzle/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHP HTTP client. This library is deprecated in favor of https://packagist.org/packages/guzzlehttp/guzzle",
|
||||||
|
"homepage": "http://guzzlephp.org/",
|
||||||
|
"keywords": [
|
||||||
|
"client",
|
||||||
|
"curl",
|
||||||
|
"framework",
|
||||||
|
"http",
|
||||||
|
"http client",
|
||||||
|
"rest",
|
||||||
|
"web service"
|
||||||
|
],
|
||||||
|
"abandoned": "guzzlehttp/guzzle",
|
||||||
|
"time": "2015-03-18 18:23:50"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "psr/log",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/php-fig/log.git",
|
||||||
|
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
|
||||||
|
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Psr\\Log\\": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "PHP-FIG",
|
||||||
|
"homepage": "http://www.php-fig.org/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Common interface for logging libraries",
|
||||||
|
"keywords": [
|
||||||
|
"log",
|
||||||
|
"psr",
|
||||||
|
"psr-3"
|
||||||
|
],
|
||||||
|
"time": "2012-12-21 11:40:51"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "satooshi/php-coveralls",
|
||||||
|
"version": "v1.0.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/satooshi/php-coveralls.git",
|
||||||
|
"reference": "da51d304fe8622bf9a6da39a8446e7afd432115c"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/satooshi/php-coveralls/zipball/da51d304fe8622bf9a6da39a8446e7afd432115c",
|
||||||
|
"reference": "da51d304fe8622bf9a6da39a8446e7afd432115c",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-json": "*",
|
||||||
|
"ext-simplexml": "*",
|
||||||
|
"guzzle/guzzle": "^2.8|^3.0",
|
||||||
|
"php": ">=5.3.3",
|
||||||
|
"psr/log": "^1.0",
|
||||||
|
"symfony/config": "^2.1|^3.0",
|
||||||
|
"symfony/console": "^2.1|^3.0",
|
||||||
|
"symfony/stopwatch": "^2.0|^3.0",
|
||||||
|
"symfony/yaml": "^2.0|^3.0"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"symfony/http-kernel": "Allows Symfony integration"
|
||||||
|
},
|
||||||
|
"bin": [
|
||||||
|
"bin/coveralls"
|
||||||
|
],
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Satooshi\\": "src/Satooshi/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Kitamura Satoshi",
|
||||||
|
"email": "with.no.parachute@gmail.com",
|
||||||
|
"homepage": "https://www.facebook.com/satooshi.jp"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHP client library for Coveralls API",
|
||||||
|
"homepage": "https://github.com/satooshi/php-coveralls",
|
||||||
|
"keywords": [
|
||||||
|
"ci",
|
||||||
|
"coverage",
|
||||||
|
"github",
|
||||||
|
"test"
|
||||||
|
],
|
||||||
|
"time": "2016-01-20 17:35:46"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/config",
|
||||||
|
"version": "v3.1.3",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/config.git",
|
||||||
|
"reference": "a7630397b91be09cdd2fe57fd13612e258700598"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/config/zipball/a7630397b91be09cdd2fe57fd13612e258700598",
|
||||||
|
"reference": "a7630397b91be09cdd2fe57fd13612e258700598",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.5.9",
|
||||||
|
"symfony/filesystem": "~2.8|~3.0"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"symfony/yaml": "To use the yaml reference dumper"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "3.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Component\\Config\\": ""
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Symfony Config Component",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"time": "2016-07-26 08:04:17"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/console",
|
||||||
|
"version": "v3.1.3",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/console.git",
|
||||||
|
"reference": "f9e638e8149e9e41b570ff092f8007c477ef0ce5"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/console/zipball/f9e638e8149e9e41b570ff092f8007c477ef0ce5",
|
||||||
|
"reference": "f9e638e8149e9e41b570ff092f8007c477ef0ce5",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.5.9",
|
||||||
|
"symfony/polyfill-mbstring": "~1.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"psr/log": "~1.0",
|
||||||
|
"symfony/event-dispatcher": "~2.8|~3.0",
|
||||||
|
"symfony/process": "~2.8|~3.0"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"psr/log": "For using the console logger",
|
||||||
|
"symfony/event-dispatcher": "",
|
||||||
|
"symfony/process": ""
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "3.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Component\\Console\\": ""
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Symfony Console Component",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"time": "2016-07-26 08:04:17"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/event-dispatcher",
|
||||||
|
"version": "v2.8.9",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/event-dispatcher.git",
|
||||||
|
"reference": "889983a79a043dfda68f38c38b6dba092dd49cd8"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/889983a79a043dfda68f38c38b6dba092dd49cd8",
|
||||||
|
"reference": "889983a79a043dfda68f38c38b6dba092dd49cd8",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.9"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"psr/log": "~1.0",
|
||||||
|
"symfony/config": "~2.0,>=2.0.5|~3.0.0",
|
||||||
|
"symfony/dependency-injection": "~2.6|~3.0.0",
|
||||||
|
"symfony/expression-language": "~2.6|~3.0.0",
|
||||||
|
"symfony/stopwatch": "~2.3|~3.0.0"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"symfony/dependency-injection": "",
|
||||||
|
"symfony/http-kernel": ""
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.8-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Component\\EventDispatcher\\": ""
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Symfony EventDispatcher Component",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"time": "2016-07-28 16:56:28"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/filesystem",
|
||||||
|
"version": "v3.1.3",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/filesystem.git",
|
||||||
|
"reference": "bb29adceb552d202b6416ede373529338136e84f"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/filesystem/zipball/bb29adceb552d202b6416ede373529338136e84f",
|
||||||
|
"reference": "bb29adceb552d202b6416ede373529338136e84f",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.5.9"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "3.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Component\\Filesystem\\": ""
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Symfony Filesystem Component",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"time": "2016-07-20 05:44:26"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/polyfill-mbstring",
|
||||||
|
"version": "v1.2.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||||
|
"reference": "dff51f72b0706335131b00a7f49606168c582594"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/dff51f72b0706335131b00a7f49606168c582594",
|
||||||
|
"reference": "dff51f72b0706335131b00a7f49606168c582594",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-mbstring": "For best performance"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.2-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Polyfill\\Mbstring\\": ""
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"bootstrap.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Grekas",
|
||||||
|
"email": "p@tchwork.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Symfony polyfill for the Mbstring extension",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"keywords": [
|
||||||
|
"compatibility",
|
||||||
|
"mbstring",
|
||||||
|
"polyfill",
|
||||||
|
"portable",
|
||||||
|
"shim"
|
||||||
|
],
|
||||||
|
"time": "2016-05-18 14:26:46"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/process",
|
||||||
|
"version": "v3.1.3",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/process.git",
|
||||||
|
"reference": "04c2dfaae4ec56a5c677b0c69fac34637d815758"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/process/zipball/04c2dfaae4ec56a5c677b0c69fac34637d815758",
|
||||||
|
"reference": "04c2dfaae4ec56a5c677b0c69fac34637d815758",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.5.9"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "3.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Component\\Process\\": ""
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Symfony Process Component",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"time": "2016-07-28 11:13:48"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/stopwatch",
|
||||||
|
"version": "v3.1.3",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/stopwatch.git",
|
||||||
|
"reference": "bb42806b12c5f89db4ebf64af6741afe6d8457e1"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/stopwatch/zipball/bb42806b12c5f89db4ebf64af6741afe6d8457e1",
|
||||||
|
"reference": "bb42806b12c5f89db4ebf64af6741afe6d8457e1",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.5.9"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "3.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Component\\Stopwatch\\": ""
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Symfony Stopwatch Component",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"time": "2016-06-29 05:41:56"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/yaml",
|
||||||
|
"version": "v3.1.3",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/yaml.git",
|
||||||
|
"reference": "1819adf2066880c7967df7180f4f662b6f0567ac"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/yaml/zipball/1819adf2066880c7967df7180f4f662b6f0567ac",
|
||||||
|
"reference": "1819adf2066880c7967df7180f4f662b6f0567ac",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.5.9"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "3.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Component\\Yaml\\": ""
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Symfony Yaml Component",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"time": "2016-07-17 14:02:08"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"aliases": [],
|
||||||
|
"minimum-stability": "stable",
|
||||||
|
"stability-flags": {
|
||||||
|
"codacy/coverage": 20,
|
||||||
|
"codeclimate/php-test-reporter": 20
|
||||||
|
},
|
||||||
|
"prefer-stable": false,
|
||||||
|
"prefer-lowest": false,
|
||||||
|
"platform": {
|
||||||
|
"php": "^5.3 || ^7.0"
|
||||||
|
},
|
||||||
|
"platform-dev": []
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PrivateBin
|
||||||
|
*
|
||||||
|
* a zero-knowledge paste bin
|
||||||
|
*
|
||||||
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
|
* @version 0.22
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace PrivateBin;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Json
|
||||||
|
*
|
||||||
|
* Provides JSON functions in an object oriented way.
|
||||||
|
*/
|
||||||
|
class Json
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Returns a string containing the JSON representation of the given input
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @static
|
||||||
|
* @param mixed $input
|
||||||
|
* @throws Exception
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function encode($input)
|
||||||
|
{
|
||||||
|
$jsonString = json_encode($input);
|
||||||
|
$errorCode = json_last_error();
|
||||||
|
if ($errorCode === JSON_ERROR_NONE) {
|
||||||
|
return $jsonString;
|
||||||
|
}
|
||||||
|
|
||||||
|
$message = 'A JSON error occurred';
|
||||||
|
if (function_exists('json_last_error_msg')) {
|
||||||
|
$message .= ': ' . json_last_error_msg();
|
||||||
|
}
|
||||||
|
$message .= ' (' . $errorCode . ')';
|
||||||
|
throw new Exception($message, 90);
|
||||||
|
}
|
||||||
|
}
|
@ -1 +0,0 @@
|
|||||||
privatebin
|
|
@ -1,10 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// autoload_files.php @generated by Composer
|
|
||||||
|
|
||||||
$vendorDir = dirname(dirname(__FILE__));
|
|
||||||
$baseDir = dirname($vendorDir);
|
|
||||||
|
|
||||||
return array(
|
|
||||||
'5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php',
|
|
||||||
);
|
|
@ -0,0 +1,241 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Identicon\Generator;
|
||||||
|
|
||||||
|
use Identicon\Generator\GeneratorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Benjamin Laugueux <benjamin@yzalis.com>
|
||||||
|
*/
|
||||||
|
class BaseGenerator
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var mixed
|
||||||
|
*/
|
||||||
|
protected $generatedImage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
protected $color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
protected $backgroundColor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
protected $size;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
protected $pixelRatio;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $hash;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $arrayOfSquare = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the image color
|
||||||
|
*
|
||||||
|
* @param string|array $color The color in hexa (6 chars) or rgb array
|
||||||
|
*
|
||||||
|
* @return this
|
||||||
|
*/
|
||||||
|
public function setColor($color)
|
||||||
|
{
|
||||||
|
if (null === $color) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->color = $this->convertColor($color);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the image background color
|
||||||
|
*
|
||||||
|
* @param string|array $backgroundColor The color in hexa (6 chars) or rgb array
|
||||||
|
*
|
||||||
|
* @return this
|
||||||
|
*/
|
||||||
|
public function setBackgroundColor($backgroundColor)
|
||||||
|
{
|
||||||
|
if (null === $backgroundColor) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->backgroundColor = $this->convertColor($backgroundColor);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function convertColor($color)
|
||||||
|
{
|
||||||
|
$convertedColor = array();
|
||||||
|
if (is_array($color)) {
|
||||||
|
$convertedColor[0] = $color[0];
|
||||||
|
$convertedColor[1] = $color[1];
|
||||||
|
$convertedColor[2] = $color[2];
|
||||||
|
} else {
|
||||||
|
if (false !== strpos($color, '#')) {
|
||||||
|
$color = substr($color, 1);
|
||||||
|
}
|
||||||
|
$convertedColor[0] = hexdec(substr($color, 0, 2));
|
||||||
|
$convertedColor[1] = hexdec(substr($color, 2, 2));
|
||||||
|
$convertedColor[2] = hexdec(substr($color, 4, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $convertedColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the color
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getColor()
|
||||||
|
{
|
||||||
|
return $this->color;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the background color
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getBackgroundColor()
|
||||||
|
{
|
||||||
|
return $this->backgroundColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the hash into an multidimensionnal array of boolean
|
||||||
|
*
|
||||||
|
* @return this
|
||||||
|
*/
|
||||||
|
private function convertHashToArrayOfBoolean()
|
||||||
|
{
|
||||||
|
preg_match_all('/(\w)(\w)/', $this->hash, $chars);
|
||||||
|
foreach ($chars[1] as $i => $char) {
|
||||||
|
if ($i % 3 == 0) {
|
||||||
|
$this->arrayOfSquare[$i/3][0] = $this->convertHexaToBoolean($char);
|
||||||
|
$this->arrayOfSquare[$i/3][4] = $this->convertHexaToBoolean($char);
|
||||||
|
} elseif ($i % 3 == 1) {
|
||||||
|
$this->arrayOfSquare[$i/3][1] = $this->convertHexaToBoolean($char);
|
||||||
|
$this->arrayOfSquare[$i/3][3] = $this->convertHexaToBoolean($char);
|
||||||
|
} else {
|
||||||
|
$this->arrayOfSquare[$i/3][2] = $this->convertHexaToBoolean($char);
|
||||||
|
}
|
||||||
|
ksort($this->arrayOfSquare[$i/3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->color[0] = hexdec(array_pop($chars[1]))*16;
|
||||||
|
$this->color[1] = hexdec(array_pop($chars[1]))*16;
|
||||||
|
$this->color[2] = hexdec(array_pop($chars[1]))*16;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert an heaxecimal number into a boolean
|
||||||
|
*
|
||||||
|
* @param string $hexa
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
private function convertHexaToBoolean($hexa)
|
||||||
|
{
|
||||||
|
return (bool) intval(round(hexdec($hexa)/10));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getArrayOfSquare()
|
||||||
|
{
|
||||||
|
return $this->arrayOfSquare;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the identicon string hash
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getHash()
|
||||||
|
{
|
||||||
|
return $this->hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a hash fron the original string
|
||||||
|
*
|
||||||
|
* @param string $string
|
||||||
|
*
|
||||||
|
* @return this
|
||||||
|
*/
|
||||||
|
public function setString($string)
|
||||||
|
{
|
||||||
|
if (null === $string) {
|
||||||
|
throw new \Exception('The string cannot be null.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->hash = md5($string);
|
||||||
|
|
||||||
|
$this->convertHashToArrayOfBoolean();
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the image size
|
||||||
|
*
|
||||||
|
* @param integer $size
|
||||||
|
*
|
||||||
|
* @return this
|
||||||
|
*/
|
||||||
|
public function setSize($size)
|
||||||
|
{
|
||||||
|
if (null === $size) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->size = $size;
|
||||||
|
$this->pixelRatio = round($size / 5);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the image size
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getSize()
|
||||||
|
{
|
||||||
|
return $this->size;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the pixel ratio
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getPixelRatio()
|
||||||
|
{
|
||||||
|
return $this->pixelRatio;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,76 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Identicon\Generator;
|
||||||
|
|
||||||
|
use Identicon\Generator\GeneratorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Benjamin Laugueux <benjamin@yzalis.com>
|
||||||
|
*/
|
||||||
|
class GdGenerator extends BaseGenerator implements GeneratorInterface
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
if (!extension_loaded('gd')) {
|
||||||
|
throw new \Exception('GD does not appear to be avaliable in your PHP installation. Please try another generator');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function generateImage()
|
||||||
|
{
|
||||||
|
// prepare image
|
||||||
|
$this->generatedImage = imagecreatetruecolor($this->getPixelRatio() * 5, $this->getPixelRatio() * 5);
|
||||||
|
|
||||||
|
$rgbBackgroundColor = $this->getBackgroundColor();
|
||||||
|
if (null === $rgbBackgroundColor) {
|
||||||
|
$background = imagecolorallocate($this->generatedImage, 0, 0, 0);
|
||||||
|
imagecolortransparent($this->generatedImage, $background);
|
||||||
|
} else {
|
||||||
|
$background = imagecolorallocate($this->generatedImage, $rgbBackgroundColor[0], $rgbBackgroundColor[1], $rgbBackgroundColor[2]);
|
||||||
|
imagefill($this->generatedImage, 0, 0, $background);
|
||||||
|
}
|
||||||
|
|
||||||
|
// prepage color
|
||||||
|
$rgbColor = $this->getColor();
|
||||||
|
$gdColor = imagecolorallocate($this->generatedImage, $rgbColor[0], $rgbColor[1], $rgbColor[2]);
|
||||||
|
|
||||||
|
// draw content
|
||||||
|
foreach ($this->getArrayOfSquare() as $lineKey => $lineValue) {
|
||||||
|
foreach ($lineValue as $colKey => $colValue) {
|
||||||
|
if (true === $colValue) {
|
||||||
|
imagefilledrectangle($this->generatedImage, $colKey * $this->getPixelRatio(), $lineKey * $this->getPixelRatio(), ($colKey + 1) * $this->getPixelRatio(), ($lineKey + 1) * $this->getPixelRatio(), $gdColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function getImageBinaryData($string, $size = null, $color = null, $backgroundColor = null)
|
||||||
|
{
|
||||||
|
ob_start();
|
||||||
|
imagepng($this->getImageResource($string, $size, $color, $backgroundColor));
|
||||||
|
$imageData = ob_get_contents();
|
||||||
|
ob_end_clean();
|
||||||
|
|
||||||
|
return $imageData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function getImageResource($string, $size = null, $color = null, $backgroundColor = null)
|
||||||
|
{
|
||||||
|
$this
|
||||||
|
->setString($string)
|
||||||
|
->setSize($size)
|
||||||
|
->setColor($color)
|
||||||
|
->setBackgroundColor($backgroundColor)
|
||||||
|
->generateImage();
|
||||||
|
|
||||||
|
return $this->generatedImage;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Identicon\Generator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Benjamin Laugueux <benjamin@yzalis.com>
|
||||||
|
*/
|
||||||
|
interface GeneratorInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param string $string
|
||||||
|
* @param integer $size
|
||||||
|
* @param array|string $color
|
||||||
|
* @param array|string $backgroundColor
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
function getImageBinaryData($string, $size = null, $color = null, $backgroundColor = null);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param string $string
|
||||||
|
* @param integer $size
|
||||||
|
* @param array|string $color
|
||||||
|
* @param array|string $backgroundColor
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function getImageResource($string, $size = null, $color = null, $backgroundColor = null);
|
||||||
|
}
|
@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Identicon\Generator;
|
||||||
|
|
||||||
|
use Identicon\Generator\GeneratorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Francis Chuang <francis.chuang@gmail.com>
|
||||||
|
*/
|
||||||
|
class ImageMagickGenerator extends BaseGenerator implements GeneratorInterface
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
if (!extension_loaded('imagick')) {
|
||||||
|
throw new \Exception('ImageMagick does not appear to be avaliable in your PHP installation. Please try another generator');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function generateImage()
|
||||||
|
{
|
||||||
|
$this->generatedImage = new \Imagick();
|
||||||
|
$rgbBackgroundColor = $this->getBackgroundColor();
|
||||||
|
|
||||||
|
if (null === $rgbBackgroundColor) {
|
||||||
|
$background = 'none';
|
||||||
|
} else {
|
||||||
|
$background = new \ImagickPixel("rgb($rgbBackgroundColor[0],$rgbBackgroundColor[1],$rgbBackgroundColor[2])");
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->generatedImage->newImage($this->pixelRatio * 5, $this->pixelRatio * 5, $background, 'png');
|
||||||
|
|
||||||
|
// prepare color
|
||||||
|
$rgbColor = $this->getColor();
|
||||||
|
$color = new \ImagickPixel("rgb($rgbColor[0],$rgbColor[1],$rgbColor[2])");
|
||||||
|
|
||||||
|
$draw = new \ImagickDraw();
|
||||||
|
$draw->setFillColor($color);
|
||||||
|
|
||||||
|
// draw the content
|
||||||
|
foreach ($this->getArrayOfSquare() as $lineKey => $lineValue) {
|
||||||
|
foreach ($lineValue as $colKey => $colValue) {
|
||||||
|
if (true === $colValue) {
|
||||||
|
$draw->rectangle( $colKey * $this->pixelRatio, $lineKey * $this->pixelRatio, ($colKey + 1) * $this->pixelRatio, ($lineKey + 1) * $this->pixelRatio);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->generatedImage->drawImage($draw);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function getImageBinaryData($string, $size = null, $color = null, $backgroundColor = null)
|
||||||
|
{
|
||||||
|
ob_start();
|
||||||
|
echo $this->getImageResource($string, $size, $color, $backgroundColor);
|
||||||
|
$imageData = ob_get_contents();
|
||||||
|
ob_end_clean();
|
||||||
|
|
||||||
|
return $imageData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function getImageResource($string, $size = null, $color = null, $backgroundColor = null)
|
||||||
|
{
|
||||||
|
$this
|
||||||
|
->setString($string)
|
||||||
|
->setSize($size)
|
||||||
|
->setColor($color)
|
||||||
|
->setBackgroundColor($backgroundColor)
|
||||||
|
->generateImage();
|
||||||
|
|
||||||
|
return $this->generatedImage;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,100 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Identicon;
|
||||||
|
|
||||||
|
use Identicon\Generator\GdGenerator;
|
||||||
|
use Identicon\Generator\GeneratorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Benjamin Laugueux <benjamin@yzalis.com>
|
||||||
|
*/
|
||||||
|
class Identicon
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var GeneratorInterface
|
||||||
|
*/
|
||||||
|
private $generator;
|
||||||
|
|
||||||
|
public function __construct($generator = null)
|
||||||
|
{
|
||||||
|
if (null === $generator) {
|
||||||
|
$this->generator = new GdGenerator();
|
||||||
|
} else {
|
||||||
|
$this->generator = $generator;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the image generetor
|
||||||
|
*
|
||||||
|
* @param GeneratorInterface $generator
|
||||||
|
*
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
public function setGenerator(GeneratorInterface $generator)
|
||||||
|
{
|
||||||
|
$this->generator = $generator;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display an Identicon image
|
||||||
|
*
|
||||||
|
* @param string $string
|
||||||
|
* @param integer $size
|
||||||
|
* @param string $color
|
||||||
|
* @param string $backgroundColor
|
||||||
|
*/
|
||||||
|
public function displayImage($string, $size = 64, $color = null, $backgroundColor = null)
|
||||||
|
{
|
||||||
|
header("Content-Type: image/png");
|
||||||
|
echo $this->getImageData($string, $size, $color, $backgroundColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an Identicon PNG image data
|
||||||
|
*
|
||||||
|
* @param string $string
|
||||||
|
* @param integer $size
|
||||||
|
* @param string $color
|
||||||
|
* @param string $backgroundColor
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getImageData($string, $size = 64, $color = null, $backgroundColor = null)
|
||||||
|
{
|
||||||
|
return $this->generator->getImageBinaryData($string, $size, $color, $backgroundColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an Identicon PNG image resource
|
||||||
|
*
|
||||||
|
* @param string $string
|
||||||
|
* @param integer $size
|
||||||
|
* @param string $color
|
||||||
|
* @param string $backgroundColor
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getImageResource($string, $size = 64, $color = null, $backgroundColor = null)
|
||||||
|
{
|
||||||
|
return $this->generator->getImageResource($string, $size, $color, $backgroundColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an Identicon PNG image data as base 64 encoded
|
||||||
|
*
|
||||||
|
* @param string $string
|
||||||
|
* @param integer $size
|
||||||
|
* @param string $color
|
||||||
|
* @param string $backgroundColor
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getImageDataUri($string, $size = 64, $color = null, $backgroundColor = null)
|
||||||
|
{
|
||||||
|
return sprintf('data:image/png;base64,%s', base64_encode($this->getImageData($string, $size, $color, $backgroundColor)));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue