Commit b0834ed9 authored by Avris's avatar Avris

remove dependency on polonisator

parent c073f914
......@@ -10,12 +10,11 @@
}],
"require": {
"avris/localisator": "^4.0",
"mustangostang/spyc": "^0.5"
"mustangostang/spyc": "^0.6"
},
"require-dev": {
"phpunit/phpunit": "^6.5",
"squizlabs/php_codesniffer": "^3.2",
"avris/polonisator": "dev-master",
"symfony/var-dumper": "^4.0"
},
"autoload": {
......
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "13eb3b4853032f2d524b3e8fa503c83e",
"content-hash": "370f70ab1938669f28e2dd0353857463",
"packages": [
{
"name": "avris/bag",
......@@ -149,16 +149,16 @@
},
{
"name": "avris/localisator",
"version": "v4.0.0",
"version": "v4.0.2",
"source": {
"type": "git",
"url": "https://gitlab.com/Avris/Localisator.git",
"reference": "381ee1d746e40736f2dd593ce4ca340db50109f7"
"reference": "f2d7691998c883ed1561efe4df7e6fc8d8fe2218"
},
"dist": {
"type": "zip",
"url": "https://gitlab.com/api/v4/projects/Avris%2FLocalisator/repository/archive.zip?sha=381ee1d746e40736f2dd593ce4ca340db50109f7",
"reference": "381ee1d746e40736f2dd593ce4ca340db50109f7",
"url": "https://gitlab.com/api/v4/projects/Avris%2FLocalisator/repository/archive.zip?sha=f2d7691998c883ed1561efe4df7e6fc8d8fe2218",
"reference": "f2d7691998c883ed1561efe4df7e6fc8d8fe2218",
"shasum": ""
},
"require": {
......@@ -199,25 +199,28 @@
}
],
"description": "A neat tool to localise messages",
"time": "2018-01-09T20:47:59+00:00"
"time": "2018-01-25T22:29:36+00:00"
},
{
"name": "mustangostang/spyc",
"version": "0.5.1",
"version": "0.6.2",
"source": {
"type": "git",
"url": "https://github.com/mustangostang/spyc.git",
"reference": "dc4785b4d7227fd9905e086d499fb8abfadf9977"
"reference": "23c35ae854d835f2d7bcc3e3ad743d7e57a8c14d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mustangostang/spyc/zipball/dc4785b4d7227fd9905e086d499fb8abfadf9977",
"reference": "dc4785b4d7227fd9905e086d499fb8abfadf9977",
"url": "https://api.github.com/repos/mustangostang/spyc/zipball/23c35ae854d835f2d7bcc3e3ad743d7e57a8c14d",
"reference": "23c35ae854d835f2d7bcc3e3ad743d7e57a8c14d",
"shasum": ""
},
"require": {
"php": ">=5.3.1"
},
"require-dev": {
"phpunit/phpunit": "4.3.*@dev"
},
"type": "library",
"extra": {
"branch-alias": {
......@@ -231,7 +234,7 @@
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT License"
"MIT"
],
"authors": [
{
......@@ -246,7 +249,7 @@
"yaml",
"yml"
],
"time": "2013-02-21T10:52:01+00:00"
"time": "2017-02-24T16:06:33+00:00"
},
{
"name": "psr/container",
......@@ -348,48 +351,6 @@
}
],
"packages-dev": [
{
"name": "avris/polonisator",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://gitlab.com/Avris/Polonisator.git",
"reference": "2f61c2cf679cc78e115130ed64c121e9c1d56cdc"
},
"dist": {
"type": "zip",
"url": "https://gitlab.com/api/v4/projects/Avris%2FPolonisator/repository/archive.zip?sha=2f61c2cf679cc78e115130ed64c121e9c1d56cdc",
"reference": "2f61c2cf679cc78e115130ed64c121e9c1d56cdc",
"shasum": ""
},
"require": {
"avris/localisator": "^4.0",
"avris/stringer": "^4.0"
},
"require-dev": {
"phpunit/phpunit": "^6.5",
"symfony/var-dumper": "^4.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Avris\\Polonisator\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Avris",
"email": "andre@avris.it",
"homepage": "https://avris.it"
}
],
"description": "An extension to Avris Localisator and Stringer introducing support for the Polish language",
"time": "2018-01-09T12:23:08+00:00"
},
{
"name": "doctrine/instantiator",
"version": "1.1.0",
......@@ -647,16 +608,16 @@
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "4.2.0",
"version": "4.3.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "66465776cfc249844bde6d117abff1d22e06c2da"
"reference": "94fd0001232e47129dd3504189fa1c7225010d08"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/66465776cfc249844bde6d117abff1d22e06c2da",
"reference": "66465776cfc249844bde6d117abff1d22e06c2da",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08",
"reference": "94fd0001232e47129dd3504189fa1c7225010d08",
"shasum": ""
},
"require": {
......@@ -694,7 +655,7 @@
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"time": "2017-11-27T17:38:31+00:00"
"time": "2017-11-30T07:14:17+00:00"
},
{
"name": "phpdocumentor/type-resolver",
......@@ -1245,16 +1206,16 @@
},
{
"name": "sebastian/comparator",
"version": "2.1.1",
"version": "2.1.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "b11c729f95109b56a0fe9650c6a63a0fcd8c439f"
"reference": "11c07feade1d65453e06df3b3b90171d6d982087"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/b11c729f95109b56a0fe9650c6a63a0fcd8c439f",
"reference": "b11c729f95109b56a0fe9650c6a63a0fcd8c439f",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/11c07feade1d65453e06df3b3b90171d6d982087",
"reference": "11c07feade1d65453e06df3b3b90171d6d982087",
"shasum": ""
},
"require": {
......@@ -1305,7 +1266,7 @@
"compare",
"equality"
],
"time": "2017-12-22T14:50:35+00:00"
"time": "2018-01-12T06:34:42+00:00"
},
{
"name": "sebastian/diff",
......@@ -2084,9 +2045,7 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"avris/polonisator": 20
},
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
......
<?php
require __DIR__ . '/../vendor/autoload.php';
foreach (glob(__DIR__ . '/_help/*.php') as $file) {
require $file;
}
<?php
namespace Avris\Polonisator\LocaleFormatter;
use Avris\Stringer\LocaleFormatter\PhoneLocaleFormatter;
final class PolishPhoneFormatter implements PhoneLocaleFormatter
{
const BLOCK_THREE = [50, 51, 53, 57, 60, 66, 69, 72, 73, 78, 79, 88, 70, 80];
public function getLocales(): array
{
return ['pl', 'pl_PL'];
}
public function getCode(): string
{
return '+48';
}
public function format($number): string
{
if (substr($number, 0, 1) === '0') {
$number = substr($number, 1);
}
if (strlen($number) === 9 && in_array(substr($number, 0, 2), self::BLOCK_THREE)) {
return substr($number, 0, 3).' '.substr($number, 3, 3) . ' ' . substr($number, 6, 3);
}
return substr($number, 0, 2) . ' ' . substr($number, 2);
}
}
<?php
namespace Avris\Polonisator;
use Avris\Container\ContainerBuilderExtension;
use Avris\Container\ContainerInterface;
use Avris\Polonisator\LocaleFormatter\PolishPhoneFormatter;
class PolonisatorExtension implements ContainerBuilderExtension
{
public function extend(ContainerInterface $container)
{
$container->setDefinition(PolishPhoneFormatter::class, ['tags' => 'phoneLocaleFormatter']);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment