Skip to content

Commit 4e5da24

Browse files
author
Andru Cherny
committed
Initial commit
0 parents  commit 4e5da24

150 files changed

Lines changed: 10725 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.coveralls.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
service_name: travis-ci
2+
coverage_clover: build/clover.xml
3+
json_path: build/coveralls-upload.json

.docker/app_test/Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM php:7.3-cli
2+
3+
RUN apt-get update && apt-get install -y git unzip
4+
5+
ENV COMPOSER_ALLOW_SUPERUSER 1
6+
ENV COMPOSER_MEMORY_LIMIT -1
7+
8+
RUN mkdir /.composer_cache
9+
ENV COMPOSER_CACHE_DIR /.composer_cache
10+
11+
RUN mkdir /packages
12+
COPY . /packages/ValueObject
13+
WORKDIR /packages/ValueObject
14+
15+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
16+
RUN composer -vvv global require hirak/prestissimo
17+
RUN composer install

.docker/php7.3-dev/Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM php:7.3-cli
2+
3+
RUN apt-get update && apt-get install -y git unzip
4+
5+
ENV COMPOSER_ALLOW_SUPERUSER 1
6+
ENV COMPOSER_MEMORY_LIMIT -1
7+
8+
RUN mkdir /.composer_cache
9+
ENV COMPOSER_CACHE_DIR /.composer_cache
10+
11+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
12+
13+
RUN composer -vvv global require hirak/prestissimo
14+
RUN composer -vvv global require ergebnis/composer-normalize
15+
RUN composer -vvv global require pyrech/composer-changelogs
16+
17+
# -------------------- Installing PHP Extension: xdebug --------------------
18+
RUN set -eux \
19+
# Installation: Generic
20+
# Type: PECL extension
21+
# Default: Pecl command
22+
&& pecl install xdebug \
23+
# Enabling
24+
&& docker-php-ext-enable xdebug \
25+
&& true

.editorconfig

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
# Unix-style newlines with a newline ending every file
5+
[*]
6+
end_of_line = lf
7+
insert_final_newline = true
8+
charset = utf-8
9+
10+
# 4 space indentation
11+
[*.php]
12+
indent_style = space
13+
indent_size = 4
14+
15+
# Tab indentation (no size specified)
16+
[Makefile]
17+
indent_style = tab
18+
19+
# Matches the exact files either package.json or .travis.yml
20+
[{*.yml, *.yaml}]
21+
indent_style = space
22+
indent_size = 2
23+
24+
[composer.json]
25+
indent_size = 4

.env

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This file is a "template" of which env vars need to be defined for your application
2+
# Copy this file to .env file for development, create environment variables when deploying to production
3+
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
4+
5+
###> symfony/framework-bundle ###
6+
APP_ENV=dev
7+
APP_SECRET=secret
8+
###< symfony/framework-bundle ###
9+
10+
###> common variables ###
11+
DOCKER_SERVER_HOST=docker.local
12+
DOCKER_SERVER_PORT=5001
13+
DOCKER_PROJECT_PATH=adgoal/common/value-object
14+
DOCKER_PHP_VERSION=7.3
15+
DOCKER_IMAGE_VERSION=master
16+
###< common variables ###

.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
###> symfony/framework-bundle ###
2+
.env.local
3+
.env.local.php
4+
.env.*.local
5+
.env.dist
6+
7+
var/
8+
vendor/
9+
###< symfony/framework-bundle ###
10+
11+
###> PhpStorm project profile ###
12+
.idea/
13+
###< PhpStorm project profile ###
14+
15+
###> phpunit/phpunit ###
16+
phpunit.xml
17+
.phpunit.result.cache
18+
###< phpunit/phpunit ###
19+
20+
###> friendsofphp/php-cs-fixer ###
21+
.php_cs.cache
22+
###< friendsofphp/php-cs-fixer ###
23+
24+
###> squizlabs/php_codesniffer ###
25+
.phpcs-cache
26+
phpcs.xml
27+
###< squizlabs/php_codesniffer ###
28+
29+
###> sensiolabs-de/deptrac ###
30+
.deptrac.cache
31+
###< sensiolabs-de/deptrac ###
32+
33+
# Build data
34+
build/
35+
36+
37+
composer.lock
38+
.gitlab-ci.yml

.travis.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
dist: xenial
2+
sudo: true
3+
cache:
4+
- directories:
5+
- /var/lib/docker
6+
env:
7+
global:
8+
- DOCKER_SERVER_HOST=docker.local
9+
- DOCKER_SERVER_PORT=5001
10+
- DOCKER_PROJECT_PATH=components/value_object
11+
- TEST_CONFIG="phpunit.xml.dist"
12+
13+
install:
14+
- export DOCKER_IMAGE_VERSION=`echo $TRAVIS_BRANCH | tr "[:upper:]" "[:lower:]" | sed "s/[^a-zA-Z0-9-]/-/g" | sed "s/-$//g" | tr -d '\n' | tr -d '\r'`
15+
- export DOCKER_IMAGE_TAG=$DOCKER_SERVER_HOST:$DOCKER_SERVER_PORT/$DOCKER_PROJECT_PATH/app_test:$DOCKER_IMAGE_VERSION
16+
- docker build . -f .docker/app_test/Dockerfile -t $DOCKER_IMAGE_TAG
17+
18+
script:
19+
- docker run $DOCKER_IMAGE_TAG vendor/bin/parallel-lint ./ --exclude vendor
20+
- docker run $DOCKER_IMAGE_TAG vendor/bin/phpstan analyse -l 6 -c phpstan.neon src tests
21+
- docker run $DOCKER_IMAGE_TAG vendor/bin/psalm --config=psalm.xml
22+
- docker run $DOCKER_IMAGE_TAG vendor/bin/ecs check src tests
23+
- docker run $DOCKER_IMAGE_TAG vendor/bin/phpmd src/ text phpmd.xml
24+
- docker run $DOCKER_IMAGE_TAG vendor/bin/phpunit --configuration $TEST_CONFIG
25+
- git log $(git describe --abbrev=0 --tags)...HEAD --no-merges --pretty=format:"* [%h](http://github.com/${TRAVIS_REPO_SLUG}/commit/%H) %s (%cN)"
26+
27+
after_success:
28+
- wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.2.0/php-coveralls.phar
29+
- travis_retry php php-coveralls.phar -v --config .coveralls.yml -v;

Makefile

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
include .env
2+
export
3+
4+
sources = bin/console config src
5+
version = $(shell git describe --tags --dirty --always)
6+
build_name = application-$(version)
7+
# use the rest as arguments for "run"
8+
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
9+
# ...and turn them into do-nothing targets
10+
#$(eval $(RUN_ARGS):;@:)
11+
12+
.PHONY: fix-permission
13+
fix-permission: ## fix permission for docker env
14+
sudo chown -R $(shell whoami):$(shell whoami) *
15+
sudo chown -R $(shell whoami):$(shell whoami) .docker/*
16+
17+
.PHONY: build
18+
build: ## build environment and initialize composer and project dependencies
19+
docker build .docker/php$(DOCKER_PHP_VERSION)-cli/ -t $(DOCKER_SERVER_HOST):$(DOCKER_SERVER_PORT)/$(DOCKER_PROJECT_PATH)/php$(DOCKER_PHP_VERSION)-cli:$(DOCKER_IMAGE_VERSION) \
20+
--build-arg DOCKER_SERVER_HOST=$(DOCKER_SERVER_HOST) \
21+
--build-arg DOCKER_SERVER_PORT=$(DOCKER_SERVER_PORT) \
22+
--build-arg DOCKER_PROJECT_PATH=$(DOCKER_PROJECT_PATH) \
23+
--build-arg DOCKER_PHP_VERSION=$(DOCKER_PHP_VERSION) \
24+
--build-arg DOCKER_IMAGE_VERSION=$(DOCKER_IMAGE_VERSION)
25+
docker-compose build
26+
docker-compose run --rm --no-deps php sh -lc 'composer install'
27+
28+
.PHONY: stop
29+
stop:
30+
docker-compose stop
31+
32+
.PHONY: composer-install
33+
composer-install: ## Install project dependencies
34+
docker-compose run --rm --no-deps php sh -lc 'composer install'
35+
36+
.PHONY: composer-update
37+
composer-update: ## Update project dependencies
38+
docker-compose run --rm --no-deps php sh -lc 'composer update'
39+
40+
.PHONY: composer-outdated
41+
composer-outdated: ## Show outdated project dependencies
42+
docker-compose run --rm --no-deps php sh -lc 'composer outdated'
43+
44+
.PHONY: composer-validate
45+
composer-validate: ## Validate composer config
46+
docker-compose run --rm --no-deps php sh -lc 'composer validate --no-check-publish'
47+
48+
.PHONY: composer
49+
composer: ## Execute composer command
50+
docker-compose run --rm --no-deps php sh -lc "composer $(RUN_ARGS)"
51+
52+
.PHONY: phpunit
53+
phpunit: ## execute project unit tests
54+
docker-compose run --rm php sh -lc "./vendor/bin/phpunit $(conf)"
55+
56+
.PHONY: style
57+
style: ## executes php analizers
58+
docker-compose run --rm --no-deps php sh -lc './vendor/bin/phpstan analyse -l 6 -c phpstan.neon src tests'
59+
docker-compose run --rm --no-deps php sh -lc './vendor/bin/psalm --config=psalm.xml'
60+
61+
.PHONY: lint
62+
lint: ## checks syntax of PHP files
63+
docker-compose run --rm --no-deps php sh -lc './vendor/bin/parallel-lint ./ --exclude vendor --exclude bin/phpunit'
64+
65+
.PHONY: logs
66+
logs: ## look for service logs
67+
docker-compose logs -f $(RUN_ARGS)
68+
69+
.PHONY: help
70+
help: ## Display this help message
71+
@cat $(MAKEFILE_LIST) | grep -e "^[a-zA-Z_\-]*: *.*## *" | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
72+
73+
.PHONY: php-shell
74+
php-shell: ## PHP shell
75+
docker-compose run --rm php sh -l
76+
77+
unit-tests: ## Run unit-tests suite
78+
docker-compose run --rm php sh -lc 'vendor/bin/phpunit --testsuite unit-tests'
79+
80+
static-analysis: style coding-standards ## Run phpstan, deprac, easycoding standarts code static analysis
81+
82+
coding-standards: ## Run check and validate code standards tests
83+
docker-compose run --rm --no-deps php sh -lc 'vendor/bin/ecs check src tests'
84+
docker-compose run --rm --no-deps php sh -lc 'vendor/bin/phpmd src/ text phpmd.xml'
85+
86+
coding-standards-fixer: ## Run code standards fixer
87+
docker-compose run --rm --no-deps php sh -lc 'vendor/bin/ecs check src tests --fix'
88+
89+
security-tests: ## The SensioLabs Security Checker
90+
docker-compose run --rm --no-deps php sh -lc 'vendor/bin/security-checker security:check --end-point=http://security.sensiolabs.org/check_lock'
91+
92+
.PHONY: test lint static-analysis phpunit coding-standards composer-validate
93+
test: build lint static-analysis coding-standards composer-validate stop ## Run all test suites

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
ValueObjects
2+
============
3+
4+
A PHP library/collection of classes aimed to help developers using and undestanding immutable objects.
5+
6+
[![Build Status](https://travis-ci.com/Adgoal/ValueObject.svg?branch=master)](https://travis-ci.com/Adgoal/ValueObject)
7+
[![Coverage Status](https://coveralls.io/repos/github/Adgoal/ValueObject/badge.svg?branch=master)](https://coveralls.io/github/Adgoal/ValueObject?branch=master)
8+
9+
[![Latest Stable Version](https://img.shields.io/packagist/v/adgoal-common/value-object.svg)](https://packagist.org/packages/adgoal-common/value-object)
10+
[![Packagist PHP version](https://img.shields.io/packagist/php-v/adgoal-common/value-object.svg)](https://packagist.org/packages/adgoal-common/value-object)
11+
12+
13+
14+
[![License](https://img.shields.io/github/license/Adgoal/ValueObject.svg)](https://github.com/Adgoal/ValueObject)
15+
[![Code size](https://img.shields.io/github/languages/code-size/Adgoal/ValueObject.svg)](https://github.com/Adgoal/ValueObject)
16+
[![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=Adgoal/ValueObject)](https://dependabot.com)

bin/geotools

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
/*
5+
* This file is part of the Geotools library.
6+
*
7+
* (c) Antoine Corcy <contact@sbin.dk>
8+
*
9+
* For the full copyright and license information, please view the LICENSE
10+
* file that was distributed with this source code.
11+
*/
12+
13+
function includeIfExists($file)
14+
{
15+
if (file_exists($file)) {
16+
return include $file;
17+
}
18+
}
19+
20+
if (!extension_loaded('curl') || !function_exists('curl_init')) {
21+
die(<<<EOT
22+
cURL has to be enabled!
23+
EOT
24+
);
25+
}
26+
27+
if ((!$loader = includeIfExists(__DIR__ . '/../vendor/autoload.php')) &&
28+
(!$loader = includeIfExists(__DIR__ . '/../../../autoload.php'))) {
29+
die(<<<EOT
30+
You must set up the project dependencies, run the following commands:
31+
$ wget http://getcomposer.org/composer.phar
32+
OR
33+
$ curl -sS https://getcomposer.org/installer | php
34+
$ php composer.phar install --dev
35+
EOT
36+
);
37+
}
38+
39+
use League\Geotools\CLI\Application;
40+
use League\Geotools\CLI\Command\Convert;
41+
use League\Geotools\CLI\Command\Distance;
42+
use League\Geotools\CLI\Command\Geocoder;
43+
use League\Geotools\CLI\Command\Geohash;
44+
use League\Geotools\CLI\Command\Vertex;
45+
use League\Geotools\Geotools;
46+
47+
$geotools = new Geotools;
48+
$console = new Application;
49+
$console->setName('Geotools :: Geo-related tools PHP 5.3+ library');
50+
$console->setVersion($geotools::VERSION);
51+
$console->add(new Convert\DM);
52+
$console->add(new Convert\DMS);
53+
$console->add(new Convert\UTM);
54+
$console->add(new Distance\All);
55+
$console->add(new Distance\Flat);
56+
$console->add(new Distance\GreatCircle);
57+
$console->add(new Distance\Haversine);
58+
$console->add(new Distance\Vincenty);
59+
$console->add(new Geocoder\Geocode);
60+
$console->add(new Geocoder\Reverse);
61+
$console->add(new Geohash\Decode);
62+
$console->add(new Geohash\Encode);
63+
$console->add(new Vertex\Destination);
64+
$console->add(new Vertex\FinalBearing);
65+
$console->add(new Vertex\FinalCardinal);
66+
$console->add(new Vertex\InitialBearing);
67+
$console->add(new Vertex\InitialCardinal);
68+
$console->add(new Vertex\Middle);
69+
$console->run();

0 commit comments

Comments
 (0)