diff --git a/dailymail/composer.json b/dailymail/composer.json index 40b0ed8..ea21348 100644 --- a/dailymail/composer.json +++ b/dailymail/composer.json @@ -4,12 +4,15 @@ "require": { "php": "^7.1.3", "ext-iconv": "*", - "cdaguerre/php-trello-api": "@dev", + "easycorp/easyadmin-bundle": "^1.17", + "google/apiclient": "^2.2", + "guzzlehttp/guzzle": "^6.3", "sensio/framework-extra-bundle": "^5.1", "symfony/asset": "^4.0", "symfony/config": "^4.0", "symfony/console": "^4.0", "symfony/dependency-injection": "^4.0", + "symfony/dotenv": "^4.0", "symfony/flex": "^1.0", "symfony/form": "^4.0", "symfony/framework-bundle": "^4.0", @@ -22,7 +25,6 @@ "symfony/yaml": "^4.0" }, "require-dev": { - "symfony/dotenv": "^4.0", "symfony/profiler-pack": "^1.0" }, "config": { diff --git a/dailymail/composer.lock b/dailymail/composer.lock index 2bb64d8..b17df73 100644 --- a/dailymail/composer.lock +++ b/dailymail/composer.lock @@ -4,55 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "becfc3a2d2876d9ca92e26365de4c83a", + "content-hash": "0a39656c41a82f4bd821ac8aac276be7", "packages": [ - { - "name": "cdaguerre/php-trello-api", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/cdaguerre/php-trello-api.git", - "reference": "579530bb46b1c096535e36295ec523f674249234" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/cdaguerre/php-trello-api/zipball/579530bb46b1c096535e36295ec523f674249234", - "reference": "579530bb46b1c096535e36295ec523f674249234", - "shasum": "" - }, - "require": { - "guzzlehttp/guzzle": "~3.7", - "php": ">=5.3" - }, - "require-dev": { - "phpunit/phpunit": "^4.8" - }, - "suggest": { - "symfony/http-foundation": "Needed for the Trello webhook service" - }, - "type": "library", - "autoload": { - "psr-0": { - "Trello\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Christian Daguerre", - "email": "christian@daguer.re" - } - ], - "description": "Trello API v1 client", - "homepage": "https://github.com/cdaguerre/php-trello-api", - "keywords": [ - "trello" - ], - "time": "2018-01-16T14:03:57+00:00" - }, { "name": "doctrine/annotations", "version": "v1.6.0", @@ -412,16 +365,16 @@ }, { "name": "doctrine/doctrine-bundle", - "version": "1.8.1", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/doctrine/DoctrineBundle.git", - "reference": "eb6e4fb904a459be28872765ab6e2d246aac7c87" + "reference": "703fad32e4c8cbe609caf45a71a1d4266c830f0f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/eb6e4fb904a459be28872765ab6e2d246aac7c87", - "reference": "eb6e4fb904a459be28872765ab6e2d246aac7c87", + "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/703fad32e4c8cbe609caf45a71a1d4266c830f0f", + "reference": "703fad32e4c8cbe609caf45a71a1d4266c830f0f", "shasum": "" }, "require": { @@ -432,13 +385,13 @@ "symfony/console": "~2.7|~3.0|~4.0", "symfony/dependency-injection": "~2.7|~3.0|~4.0", "symfony/doctrine-bridge": "~2.7|~3.0|~4.0", - "symfony/framework-bundle": "~2.7|~3.0|~4.0" + "symfony/framework-bundle": "^2.7.22|~3.0|~4.0" }, "conflict": { "symfony/http-foundation": "<2.6" }, "require-dev": { - "doctrine/orm": "~2.3", + "doctrine/orm": "~2.4", "phpunit/phpunit": "^4.8.36|^5.7|^6.4", "satooshi/php-coveralls": "^1.0", "symfony/phpunit-bridge": "~2.7|~3.0|~4.0", @@ -493,7 +446,7 @@ "orm", "persistence" ], - "time": "2017-11-24T13:09:19+00:00" + "time": "2018-04-19T14:07:39+00:00" }, { "name": "doctrine/doctrine-cache-bundle", @@ -974,67 +927,321 @@ "time": "2018-02-27T07:30:56+00:00" }, { - "name": "guzzlehttp/guzzle", - "version": "v3.8.1", + "name": "easycorp/easyadmin-bundle", + "version": "v1.17.12", "source": { "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "4de0618a01b34aa1c8c33a3f13f396dcd3882eba" + "url": "https://github.com/EasyCorp/EasyAdminBundle.git", + "reference": "f9114922faf5be8a4d5e70a774e672a67250baec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/4de0618a01b34aa1c8c33a3f13f396dcd3882eba", - "reference": "4de0618a01b34aa1c8c33a3f13f396dcd3882eba", + "url": "https://api.github.com/repos/EasyCorp/EasyAdminBundle/zipball/f9114922faf5be8a4d5e70a774e672a67250baec", + "reference": "f9114922faf5be8a4d5e70a774e672a67250baec", "shasum": "" }, "require": { - "ext-curl": "*", - "php": ">=5.3.3", - "symfony/event-dispatcher": ">=2.1" + "doctrine/cache": "~1.5", + "doctrine/common": "^2.4.0", + "doctrine/doctrine-bundle": "~1.2", + "doctrine/orm": "~2.3", + "pagerfanta/pagerfanta": "~1.0,>=1.0.1", + "php": ">=5.3.0", + "sensio/framework-extra-bundle": "~2.3|~3.0,>=3.0.2|4.0.x|~5.0", + "symfony/asset": "~2.3|~3.0|^4.0", + "symfony/config": "~2.3|~3.0|^4.0", + "symfony/dependency-injection": "~2.3|~3.0|^4.0", + "symfony/doctrine-bridge": "~2.3|~3.0|^4.0", + "symfony/event-dispatcher": "~2.3|~3.0|^4.0", + "symfony/form": "~2.3|~3.0|^4.0", + "symfony/framework-bundle": "~2.3|~3.0|^4.0", + "symfony/http-foundation": "~2.3|~3.0|^4.0", + "symfony/http-kernel": "~2.3|~3.0|^4.0", + "symfony/polyfill-mbstring": "^1.0", + "symfony/property-access": "~2.3|~3.0|^4.0", + "symfony/security-bundle": "~2.3|~3.0|^4.0", + "symfony/translation": "~2.3|~3.0|^4.0", + "symfony/twig-bridge": "^2.3.4|~3.0|^4.0", + "symfony/twig-bundle": "~2.3|~3.0|^4.0", + "symfony/validator": "~2.3|~3.0|^4.0", + "twig/extensions": "~1.0", + "twig/twig": "~1.26|~2.0" }, - "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/doctrine-fixtures-bundle": "~2.2", + "psr/log": "~1.0", + "symfony/browser-kit": "~2.3|~3.0|^4.0", + "symfony/console": "~2.3|~3.0|^4.0", + "symfony/css-selector": "~2.3|~3.0|^4.0", + "symfony/dom-crawler": "~2.3|~3.0|^4.0", + "symfony/finder": "~2.3|~3.0|^4.0", + "symfony/phpunit-bridge": "^3.2|^4.0", + "symfony/var-dumper": "~2.3|~3.0|^4.0", + "symfony/yaml": "~2.3|~3.0|^4.0" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "1.17.x-dev" + } + }, + "autoload": { + "psr-4": { + "EasyCorp\\Bundle\\EasyAdminBundle\\": "src/", + "JavierEguiluz\\Bundle\\EasyAdminBundle\\": "legacy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Javier Eguiluz", + "email": "javiereguiluz@gmail.com" + }, + { + "name": "Project Contributors", + "homepage": "http://github.com/javiereguiluz/easyadmin/blob/master/CONTRIBUTORS.md" + } + ], + "description": "Admin generator for Symfony applications", + "homepage": "https://github.com/javiereguiluz/EasyAdminBundle", + "keywords": [ + "admin", + "backend", + "generator" + ], + "time": "2018-02-24T09:24:55+00:00" + }, + { + "name": "firebase/php-jwt", + "version": "v5.0.0", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "9984a4d3a32ae7673d6971ea00bae9d0a1abba0e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/9984a4d3a32ae7673d6971ea00bae9d0a1abba0e", + "reference": "9984a4d3a32ae7673d6971ea00bae9d0a1abba0e", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" }, "require-dev": { - "doctrine/cache": "*", - "monolog/monolog": "1.*", - "phpunit/phpunit": "3.7.*", - "psr/log": "1.0.*", - "symfony/class-loader": "*", - "zendframework/zend-cache": "<2.3", - "zendframework/zend-log": "<2.3" + "phpunit/phpunit": " 4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "time": "2017-06-27T22:17:23+00:00" + }, + { + "name": "google/apiclient", + "version": "v2.2.1", + "source": { + "type": "git", + "url": "https://github.com/google/google-api-php-client.git", + "reference": "b69b8ac4bf6501793c389d4e013a79d09c85c5f2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/google-api-php-client/zipball/b69b8ac4bf6501793c389d4e013a79d09c85c5f2", + "reference": "b69b8ac4bf6501793c389d4e013a79d09c85c5f2", + "shasum": "" + }, + "require": { + "firebase/php-jwt": "~2.0|~3.0|~4.0|~5.0", + "google/apiclient-services": "~0.13", + "google/auth": "^1.0", + "guzzlehttp/guzzle": "~5.3.1|~6.0", + "guzzlehttp/psr7": "^1.2", + "monolog/monolog": "^1.17", + "php": ">=5.4", + "phpseclib/phpseclib": "~0.3.10|~2.0" + }, + "require-dev": { + "cache/filesystem-adapter": "^0.3.2", + "phpunit/phpunit": "~4", + "squizlabs/php_codesniffer": "~2.3", + "symfony/css-selector": "~2.1", + "symfony/dom-crawler": "~2.1" + }, + "suggest": { + "cache/filesystem-adapter": "For caching certs and tokens (using Google_Client::setCache)" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.8-dev" + "dev-master": "2.x-dev" } }, "autoload": { "psr-0": { - "Guzzle": "src/", - "Guzzle\\Tests": "tests/" + "Google_": "src/" + }, + "classmap": [ + "src/Google/Service/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Client library for Google APIs", + "homepage": "http://developers.google.com/api-client-library/php", + "keywords": [ + "google" + ], + "time": "2017-11-03T01:19:53+00:00" + }, + { + "name": "google/apiclient-services", + "version": "v0.57", + "source": { + "type": "git", + "url": "https://github.com/google/google-api-php-client-services.git", + "reference": "fc1821419f0e9d060d83a2864e2a40874b91430d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/google-api-php-client-services/zipball/fc1821419f0e9d060d83a2864e2a40874b91430d", + "reference": "fc1821419f0e9d060d83a2864e2a40874b91430d", + "shasum": "" + }, + "require": { + "php": ">=5.4" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "type": "library", + "autoload": { + "psr-0": { + "Google_Service_": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Client library for Google APIs", + "homepage": "http://developers.google.com/api-client-library/php", + "keywords": [ + "google" + ], + "time": "2018-04-28T00:23:39+00:00" + }, + { + "name": "google/auth", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/google/google-auth-library-php.git", + "reference": "8f7c96146b2c62d3f4c6bbc4b5bb8a8e396b0b71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/8f7c96146b2c62d3f4c6bbc4b5bb8a8e396b0b71", + "reference": "8f7c96146b2c62d3f4c6bbc4b5bb8a8e396b0b71", + "shasum": "" + }, + "require": { + "firebase/php-jwt": "~2.0|~3.0|~4.0|~5.0", + "guzzlehttp/guzzle": "~5.3.1|~6.0", + "guzzlehttp/psr7": "^1.2", + "php": ">=5.4", + "psr/cache": "^1.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^1.11", + "guzzlehttp/promises": "0.1.1|^1.3", + "phpunit/phpunit": "^4.8.36|^5.7", + "sebastian/comparator": ">=1.2.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Google\\Auth\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Google Auth Library for PHP", + "homepage": "http://github.com/google/google-auth-library-php", + "keywords": [ + "Authentication", + "google", + "oauth2" + ], + "time": "2018-04-06T19:26:30+00:00" + }, + { + "name": "guzzlehttp/guzzle", + "version": "6.3.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.4", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "psr/log": "^1.0" + }, + "suggest": { + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.3-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1046,13 +1253,9 @@ "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" - }, - { - "name": "Guzzle Community", - "homepage": "https://github.com/guzzle/guzzle/contributors" } ], - "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients", + "description": "Guzzle is a PHP HTTP client library", "homepage": "http://guzzlephp.org/", "keywords": [ "client", @@ -1063,7 +1266,123 @@ "rest", "web service" ], - "time": "2014-01-28T22:29:15+00:00" + "time": "2018-04-22T15:46:56+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-12-20T10:07:11+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2017-03-20T17:10:46+00:00" }, { "name": "jdorn/sql-formatter", @@ -1115,6 +1434,84 @@ ], "time": "2014-01-12T16:20:24+00:00" }, + { + "name": "monolog/monolog", + "version": "1.23.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4", + "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "ruflin/elastica": ">=0.90 <3.0", + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "^5.3|^6.0" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "sentry/sentry": "Allow sending log messages to a Sentry server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2017-06-19T01:22:40+00:00" + }, { "name": "nikic/php-parser", "version": "v4.0.1", @@ -1284,6 +1681,167 @@ ], "time": "2017-05-04T11:12:50+00:00" }, + { + "name": "pagerfanta/pagerfanta", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/whiteoctober/Pagerfanta.git", + "reference": "8400ab498e500018cff9a099ac22555e7949aa9a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/whiteoctober/Pagerfanta/zipball/8400ab498e500018cff9a099ac22555e7949aa9a", + "reference": "8400ab498e500018cff9a099ac22555e7949aa9a", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "doctrine/orm": "~2.3", + "doctrine/phpcr-odm": "1.*", + "jackalope/jackalope-doctrine-dbal": "1.*", + "jmikola/geojson": "~1.0", + "mandango/mandango": "~1.0@dev", + "mandango/mondator": "~1.0@dev", + "phpunit/phpunit": "^4.8.35 | ^5.7", + "propel/propel": "~2.0@dev", + "propel/propel1": "~1.6", + "ruflin/elastica": "~1.3", + "solarium/solarium": "~3.1" + }, + "suggest": { + "doctrine/mongodb-odm": "To use the DoctrineODMMongoDBAdapter.", + "doctrine/orm": "To use the DoctrineORMAdapter.", + "doctrine/phpcr-odm": "To use the DoctrineODMPhpcrAdapter. >= 1.1.0", + "mandango/mandango": "To use the MandangoAdapter.", + "propel/propel": "To use the Propel2Adapter", + "propel/propel1": "To use the PropelAdapter", + "solarium/solarium": "To use the SolariumAdapter." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Pagerfanta\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Pablo Díez", + "email": "pablodip@gmail.com" + } + ], + "description": "Pagination for PHP 5.3", + "keywords": [ + "page", + "pagination", + "paginator", + "paging" + ], + "time": "2018-05-01T10:49:10+00:00" + }, + { + "name": "phpseclib/phpseclib", + "version": "2.0.11", + "source": { + "type": "git", + "url": "https://github.com/phpseclib/phpseclib.git", + "reference": "7053f06f91b3de78e143d430e55a8f7889efc08b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/7053f06f91b3de78e143d430e55a8f7889efc08b", + "reference": "7053f06f91b3de78e143d430e55a8f7889efc08b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phing/phing": "~2.7", + "phpunit/phpunit": "^4.8.35|^5.7|^6.0", + "sami/sami": "~2.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "suggest": { + "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.", + "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.", + "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", + "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations." + }, + "type": "library", + "autoload": { + "files": [ + "phpseclib/bootstrap.php" + ], + "psr-4": { + "phpseclib\\": "phpseclib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jim Wigginton", + "email": "terrafrost@php.net", + "role": "Lead Developer" + }, + { + "name": "Patrick Monnerat", + "email": "pm@datasphere.ch", + "role": "Developer" + }, + { + "name": "Andreas Fischer", + "email": "bantu@phpbb.com", + "role": "Developer" + }, + { + "name": "Hans-Jürgen Petrich", + "email": "petrich@tronic-media.com", + "role": "Developer" + }, + { + "name": "Graham Campbell", + "email": "graham@alt-three.com", + "role": "Developer" + } + ], + "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.", + "homepage": "http://phpseclib.sourceforge.net", + "keywords": [ + "BigInteger", + "aes", + "asn.1", + "asn1", + "blowfish", + "crypto", + "cryptography", + "encryption", + "rsa", + "security", + "sftp", + "signature", + "signing", + "ssh", + "twofish", + "x.509", + "x509" + ], + "time": "2018-04-15T16:55:05+00:00" + }, { "name": "psr/cache", "version": "1.0.1", @@ -1331,17 +1889,66 @@ "time": "2016-08-06T20:24:11+00:00" }, { - "name": "psr/container", - "version": "1.0.0", + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", "shasum": "" }, "require": { @@ -1355,7 +1962,7 @@ }, "autoload": { "psr-4": { - "Psr\\Container\\": "src/" + "Psr\\Http\\Message\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1368,16 +1975,17 @@ "homepage": "http://www.php-fig.org/" } ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" ], - "time": "2017-02-14T16:28:37+00:00" + "time": "2016-08-06T14:39:51+00:00" }, { "name": "psr/log", @@ -1545,7 +2153,7 @@ }, { "name": "symfony/asset", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/asset.git", @@ -1601,16 +2209,16 @@ }, { "name": "symfony/cache", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "681c245e629409a2f1ded6bf783e833d291d8af2" + "reference": "ff96ef34437ccc2c0737677c1bf14904a2b9482d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/681c245e629409a2f1ded6bf783e833d291d8af2", - "reference": "681c245e629409a2f1ded6bf783e833d291d8af2", + "url": "https://api.github.com/repos/symfony/cache/zipball/ff96ef34437ccc2c0737677c1bf14904a2b9482d", + "reference": "ff96ef34437ccc2c0737677c1bf14904a2b9482d", "shasum": "" }, "require": { @@ -1666,11 +2274,11 @@ "caching", "psr6" ], - "time": "2018-04-02T14:35:51+00:00" + "time": "2018-04-30T01:05:59+00:00" }, { "name": "symfony/config", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/config.git", @@ -1732,16 +2340,16 @@ }, { "name": "symfony/console", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "aad9a6fe47319f22748fd764f52d3a7ca6fa6b64" + "reference": "3e820bc2c520a87ca209ad8fa961c97f42e0b4ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/aad9a6fe47319f22748fd764f52d3a7ca6fa6b64", - "reference": "aad9a6fe47319f22748fd764f52d3a7ca6fa6b64", + "url": "https://api.github.com/repos/symfony/console/zipball/3e820bc2c520a87ca209ad8fa961c97f42e0b4ae", + "reference": "3e820bc2c520a87ca209ad8fa961c97f42e0b4ae", "shasum": "" }, "require": { @@ -1761,7 +2369,7 @@ "symfony/process": "~3.4|~4.0" }, "suggest": { - "psr/log": "For using the console logger", + "psr/log-implementation": "For using the console logger", "symfony/event-dispatcher": "", "symfony/lock": "", "symfony/process": "" @@ -1796,20 +2404,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-04-03T05:24:00+00:00" + "time": "2018-04-30T01:23:47+00:00" }, { "name": "symfony/debug", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "5961d02d48828671f5d8a7805e06579d692f6ede" + "reference": "e1d57cdb357e5b10f5fdacbb0b86689c0a435e6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/5961d02d48828671f5d8a7805e06579d692f6ede", - "reference": "5961d02d48828671f5d8a7805e06579d692f6ede", + "url": "https://api.github.com/repos/symfony/debug/zipball/e1d57cdb357e5b10f5fdacbb0b86689c0a435e6e", + "reference": "e1d57cdb357e5b10f5fdacbb0b86689c0a435e6e", "shasum": "" }, "require": { @@ -1852,20 +2460,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-04-03T05:24:00+00:00" + "time": "2018-04-30T16:59:37+00:00" }, { "name": "symfony/dependency-injection", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "9f1cea656afc5512c6f5e58d61fcea12acee113e" + "reference": "1f99622d8a63b160bfdd0ad7b2da56ee413cba64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/9f1cea656afc5512c6f5e58d61fcea12acee113e", - "reference": "9f1cea656afc5512c6f5e58d61fcea12acee113e", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/1f99622d8a63b160bfdd0ad7b2da56ee413cba64", + "reference": "1f99622d8a63b160bfdd0ad7b2da56ee413cba64", "shasum": "" }, "require": { @@ -1923,20 +2531,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2018-04-02T09:52:41+00:00" + "time": "2018-04-30T01:05:59+00:00" }, { "name": "symfony/doctrine-bridge", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/doctrine-bridge.git", - "reference": "6743ff309bee333f885b237d04e81652f73f51a3" + "reference": "9ef7076f5b3f40c61ff2598fafe67ae778687c78" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/doctrine-bridge/zipball/6743ff309bee333f885b237d04e81652f73f51a3", - "reference": "6743ff309bee333f885b237d04e81652f73f51a3", + "url": "https://api.github.com/repos/symfony/doctrine-bridge/zipball/9ef7076f5b3f40c61ff2598fafe67ae778687c78", + "reference": "9ef7076f5b3f40c61ff2598fafe67ae778687c78", "shasum": "" }, "require": { @@ -2002,11 +2610,68 @@ ], "description": "Symfony Doctrine Bridge", "homepage": "https://symfony.com", - "time": "2018-03-19T22:35:49+00:00" + "time": "2018-04-26T16:12:06+00:00" + }, + { + "name": "symfony/dotenv", + "version": "v4.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/dotenv.git", + "reference": "afb6923923e22874dac20bd042167ccb8df1d158" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/dotenv/zipball/afb6923923e22874dac20bd042167ccb8df1d158", + "reference": "afb6923923e22874dac20bd042167ccb8df1d158", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "require-dev": { + "symfony/process": "~3.4|~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Dotenv\\": "" + }, + "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": "Registers environment variables from a .env file", + "homepage": "https://symfony.com", + "keywords": [ + "dotenv", + "env", + "environment" + ], + "time": "2018-01-03T17:15:19+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -2069,7 +2734,7 @@ }, { "name": "symfony/filesystem", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", @@ -2118,7 +2783,7 @@ }, { "name": "symfony/finder", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -2167,16 +2832,16 @@ }, { "name": "symfony/flex", - "version": "v1.0.78", + "version": "v1.0.80", "source": { "type": "git", "url": "https://github.com/symfony/flex.git", - "reference": "eead30b31db70691cd1fd1e7225190c818a1a5f6" + "reference": "729aee08d62b47224e85b83c97e2824ff7d1735e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/flex/zipball/eead30b31db70691cd1fd1e7225190c818a1a5f6", - "reference": "eead30b31db70691cd1fd1e7225190c818a1a5f6", + "url": "https://api.github.com/repos/symfony/flex/zipball/729aee08d62b47224e85b83c97e2824ff7d1735e", + "reference": "729aee08d62b47224e85b83c97e2824ff7d1735e", "shasum": "" }, "require": { @@ -2209,20 +2874,20 @@ "email": "fabien.potencier@gmail.com" } ], - "time": "2018-03-27T10:04:58+00:00" + "time": "2018-05-02T19:08:56+00:00" }, { "name": "symfony/form", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/form.git", - "reference": "8605af5a9181d44637de5706e32d8ab9caee799e" + "reference": "1ddddddaf43a812aee6fb5795dc8b3ee3117c0a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/form/zipball/8605af5a9181d44637de5706e32d8ab9caee799e", - "reference": "8605af5a9181d44637de5706e32d8ab9caee799e", + "url": "https://api.github.com/repos/symfony/form/zipball/1ddddddaf43a812aee6fb5795dc8b3ee3117c0a1", + "reference": "1ddddddaf43a812aee6fb5795dc8b3ee3117c0a1", "shasum": "" }, "require": { @@ -2289,20 +2954,20 @@ ], "description": "Symfony Form Component", "homepage": "https://symfony.com", - "time": "2018-04-06T07:35:43+00:00" + "time": "2018-04-20T10:04:09+00:00" }, { "name": "symfony/framework-bundle", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/framework-bundle.git", - "reference": "3571d235434b566aea39d8f8bfe38860344fd9a3" + "reference": "a9ad75416b86e0c472abb2c1e8799563d6ed6b56" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/3571d235434b566aea39d8f8bfe38860344fd9a3", - "reference": "3571d235434b566aea39d8f8bfe38860344fd9a3", + "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/a9ad75416b86e0c472abb2c1e8799563d6ed6b56", + "reference": "a9ad75416b86e0c472abb2c1e8799563d6ed6b56", "shasum": "" }, "require": { @@ -2403,20 +3068,20 @@ ], "description": "Symfony FrameworkBundle", "homepage": "https://symfony.com", - "time": "2018-04-04T18:24:59+00:00" + "time": "2018-04-30T16:59:37+00:00" }, { "name": "symfony/http-foundation", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "d0864a82e5891ab61d31eecbaa48bed5a09b8e6c" + "reference": "014487772c22d893168e5d628a13e882009fea29" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/d0864a82e5891ab61d31eecbaa48bed5a09b8e6c", - "reference": "d0864a82e5891ab61d31eecbaa48bed5a09b8e6c", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/014487772c22d893168e5d628a13e882009fea29", + "reference": "014487772c22d893168e5d628a13e882009fea29", "shasum": "" }, "require": { @@ -2456,20 +3121,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2018-04-03T05:24:00+00:00" + "time": "2018-04-30T01:05:59+00:00" }, { "name": "symfony/http-kernel", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "6dd620d96d64456075536ffe3c6c4658dd689021" + "reference": "8333264b6de323ea27a08627d5396aa564fb9c25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/6dd620d96d64456075536ffe3c6c4658dd689021", - "reference": "6dd620d96d64456075536ffe3c6c4658dd689021", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/8333264b6de323ea27a08627d5396aa564fb9c25", + "reference": "8333264b6de323ea27a08627d5396aa564fb9c25", "shasum": "" }, "require": { @@ -2542,11 +3207,11 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2018-04-06T16:25:03+00:00" + "time": "2018-04-30T19:45:57+00:00" }, { "name": "symfony/inflector", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/inflector.git", @@ -2603,7 +3268,7 @@ }, { "name": "symfony/intl", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/intl.git", @@ -2771,22 +3436,22 @@ }, { "name": "symfony/maker-bundle", - "version": "v1.4.0", + "version": "v1.4.4", "source": { "type": "git", "url": "https://github.com/symfony/maker-bundle.git", - "reference": "253cee42124de11dc0a5bb7c91e5375d7197be12" + "reference": "eeb9027bbd3472f2d76455cc478b04bbb0eab932" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/maker-bundle/zipball/253cee42124de11dc0a5bb7c91e5375d7197be12", - "reference": "253cee42124de11dc0a5bb7c91e5375d7197be12", + "url": "https://api.github.com/repos/symfony/maker-bundle/zipball/eeb9027bbd3472f2d76455cc478b04bbb0eab932", + "reference": "eeb9027bbd3472f2d76455cc478b04bbb0eab932", "shasum": "" }, "require": { "doctrine/inflector": "^1.2", "nikic/php-parser": "^4.0", - "php": "^7.1.3", + "php": "^7.0.8", "symfony/config": "^3.4|^4.0", "symfony/console": "^3.4|^4.0", "symfony/dependency-injection": "^3.4|^4.0", @@ -2798,7 +3463,7 @@ "require-dev": { "allocine/twigcs": "^3.0", "doctrine/doctrine-bundle": "^1.8", - "doctrine/orm": "^2.6", + "doctrine/orm": "^2.3", "friendsofphp/php-cs-fixer": "^2.8", "symfony/phpunit-bridge": "^3.4|^4.0", "symfony/process": "^3.4|^4.0" @@ -2832,11 +3497,11 @@ "scaffold", "scaffolding" ], - "time": "2018-04-11T22:44:12+00:00" + "time": "2018-05-02T13:20:32+00:00" }, { "name": "symfony/options-resolver", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", @@ -2918,16 +3583,16 @@ }, { "name": "symfony/polyfill-intl-icu", - "version": "v1.7.0", + "version": "v1.8.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-icu.git", - "reference": "254919c03761d46c29291616576ed003f10e91c1" + "reference": "80ee17ae83c10cd513e5144f91a73607a21edb4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/254919c03761d46c29291616576ed003f10e91c1", - "reference": "254919c03761d46c29291616576ed003f10e91c1", + "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/80ee17ae83c10cd513e5144f91a73607a21edb4e", + "reference": "80ee17ae83c10cd513e5144f91a73607a21edb4e", "shasum": "" }, "require": { @@ -2940,7 +3605,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7-dev" + "dev-master": "1.8-dev" } }, "autoload": { @@ -2972,20 +3637,20 @@ "portable", "shim" ], - "time": "2018-01-30T19:27:44+00:00" + "time": "2018-04-25T14:53:50+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.7.0", + "version": "v1.8.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b" + "reference": "3296adf6a6454a050679cde90f95350ad604b171" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/78be803ce01e55d3491c1397cf1c64beb9c1b63b", - "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", + "reference": "3296adf6a6454a050679cde90f95350ad604b171", "shasum": "" }, "require": { @@ -2997,7 +3662,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7-dev" + "dev-master": "1.8-dev" } }, "autoload": { @@ -3031,11 +3696,11 @@ "portable", "shim" ], - "time": "2018-01-30T19:27:44+00:00" + "time": "2018-04-26T10:06:28+00:00" }, { "name": "symfony/property-access", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/property-access.git", @@ -3102,16 +3767,16 @@ }, { "name": "symfony/routing", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "0663036dd57dbfd4e9ff29f75bbd5dd3253ebe71" + "reference": "1dfbfdf060bbc80da8dedc062050052e694cd027" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/0663036dd57dbfd4e9ff29f75bbd5dd3253ebe71", - "reference": "0663036dd57dbfd4e9ff29f75bbd5dd3253ebe71", + "url": "https://api.github.com/repos/symfony/routing/zipball/1dfbfdf060bbc80da8dedc062050052e694cd027", + "reference": "1dfbfdf060bbc80da8dedc062050052e694cd027", "shasum": "" }, "require": { @@ -3176,43 +3841,136 @@ "uri", "url" ], - "time": "2018-04-04T13:50:32+00:00" + "time": "2018-04-20T06:20:23+00:00" }, { - "name": "symfony/security-core", - "version": "v4.0.8", + "name": "symfony/security", + "version": "v3.4.9", "source": { "type": "git", - "url": "https://github.com/symfony/security-core.git", - "reference": "8ce2a08e7e8a791aae8cc26ee892c9ca414bd23b" + "url": "https://github.com/symfony/security.git", + "reference": "0036371ec9835895c269f35c9015d326d3da8d48" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-core/zipball/8ce2a08e7e8a791aae8cc26ee892c9ca414bd23b", - "reference": "8ce2a08e7e8a791aae8cc26ee892c9ca414bd23b", + "url": "https://api.github.com/repos/symfony/security/zipball/0036371ec9835895c269f35c9015d326d3da8d48", + "reference": "0036371ec9835895c269f35c9015d326d3da8d48", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": "^5.5.9|>=7.0.8", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/http-foundation": "^2.8.31|~3.3.13|~3.4|~4.0", + "symfony/http-kernel": "~3.3|~4.0", + "symfony/polyfill-php56": "~1.0", + "symfony/polyfill-php70": "~1.0", + "symfony/property-access": "~2.8|~3.0|~4.0" + }, + "replace": { + "symfony/security-core": "self.version", + "symfony/security-csrf": "self.version", + "symfony/security-guard": "self.version", + "symfony/security-http": "self.version" }, "require-dev": { "psr/container": "^1.0", "psr/log": "~1.0", - "symfony/event-dispatcher": "~3.4|~4.0", - "symfony/expression-language": "~3.4|~4.0", - "symfony/http-foundation": "~3.4|~4.0", - "symfony/ldap": "~3.4|~4.0", - "symfony/validator": "~3.4|~4.0" + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/ldap": "~3.1|~4.0", + "symfony/polyfill-intl-icu": "~1.0", + "symfony/routing": "~2.8|~3.0|~4.0", + "symfony/validator": "^3.2.5|~4.0" }, "suggest": { - "psr/container": "To instantiate the Security class", - "symfony/event-dispatcher": "", + "psr/container-implementation": "To instantiate the Security class", "symfony/expression-language": "For using the expression voter", - "symfony/http-foundation": "", - "symfony/ldap": "For using LDAP integration", + "symfony/form": "", + "symfony/ldap": "For using the LDAP user and authentication providers", + "symfony/routing": "For using the HttpUtils class to create sub-requests, redirect the user, and match URLs", "symfony/validator": "For using the user password constraint" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Security\\": "" + }, + "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 Security Component", + "homepage": "https://symfony.com", + "time": "2018-04-30T01:22:56+00:00" + }, + { + "name": "symfony/security-bundle", + "version": "v4.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/security-bundle.git", + "reference": "dfabecc1fd3e626e676edef97753a645b4de85a5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/security-bundle/zipball/dfabecc1fd3e626e676edef97753a645b4de85a5", + "reference": "dfabecc1fd3e626e676edef97753a645b4de85a5", + "shasum": "" + }, + "require": { + "ext-xml": "*", + "php": "^7.1.3", + "symfony/dependency-injection": "^3.4.3|^4.0.3", + "symfony/http-kernel": "~3.4|~4.0", + "symfony/security": "~3.4|~4.0" + }, + "conflict": { + "symfony/console": "<3.4", + "symfony/event-dispatcher": "<3.4", + "symfony/framework-bundle": "<3.4", + "symfony/var-dumper": "<3.4" + }, + "require-dev": { + "doctrine/doctrine-bundle": "~1.5", + "symfony/asset": "~3.4|~4.0", + "symfony/browser-kit": "~3.4|~4.0", + "symfony/console": "~3.4|~4.0", + "symfony/css-selector": "~3.4|~4.0", + "symfony/dom-crawler": "~3.4|~4.0", + "symfony/event-dispatcher": "~3.4|~4.0", + "symfony/expression-language": "~3.4|~4.0", + "symfony/form": "~3.4|~4.0", + "symfony/framework-bundle": "~3.4|~4.0", + "symfony/http-foundation": "~3.4|~4.0", + "symfony/process": "~3.4|~4.0", + "symfony/translation": "~3.4|~4.0", + "symfony/twig-bridge": "~3.4|~4.0", + "symfony/twig-bundle": "~3.4|~4.0", + "symfony/validator": "~3.4|~4.0", + "symfony/var-dumper": "~3.4|~4.0", + "symfony/yaml": "~3.4|~4.0", + "twig/twig": "~1.34|~2.4" + }, + "type": "symfony-bundle", "extra": { "branch-alias": { "dev-master": "4.0-dev" @@ -3220,7 +3978,7 @@ }, "autoload": { "psr-4": { - "Symfony\\Component\\Security\\Core\\": "" + "Symfony\\Bundle\\SecurityBundle\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -3240,13 +3998,13 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Security Component - Core Library", + "description": "Symfony SecurityBundle", "homepage": "https://symfony.com", "time": "2018-04-06T07:35:43+00:00" }, { "name": "symfony/security-csrf", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/security-csrf.git", @@ -3305,16 +4063,16 @@ }, { "name": "symfony/translation", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "e20a9b7f9f62cb33a11638b345c248e7d510c938" + "reference": "ad3abf08eb3450491d8d76513100ef58194cd13e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/e20a9b7f9f62cb33a11638b345c248e7d510c938", - "reference": "e20a9b7f9f62cb33a11638b345c248e7d510c938", + "url": "https://api.github.com/repos/symfony/translation/zipball/ad3abf08eb3450491d8d76513100ef58194cd13e", + "reference": "ad3abf08eb3450491d8d76513100ef58194cd13e", "shasum": "" }, "require": { @@ -3335,7 +4093,7 @@ "symfony/yaml": "~3.4|~4.0" }, "suggest": { - "psr/log": "To use logging capability in translator", + "psr/log-implementation": "To use logging capability in translator", "symfony/config": "", "symfony/yaml": "" }, @@ -3369,20 +4127,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2018-02-22T10:50:29+00:00" + "time": "2018-04-30T01:23:47+00:00" }, { "name": "symfony/twig-bridge", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/twig-bridge.git", - "reference": "7596e74f91d9c2ecb5de35811b87655e9533096f" + "reference": "fc1258b7039d45f3e2230c74c086755832bc9c07" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/7596e74f91d9c2ecb5de35811b87655e9533096f", - "reference": "7596e74f91d9c2ecb5de35811b87655e9533096f", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/fc1258b7039d45f3e2230c74c086755832bc9c07", + "reference": "fc1258b7039d45f3e2230c74c086755832bc9c07", "shasum": "" }, "require": { @@ -3391,7 +4149,7 @@ }, "conflict": { "symfony/console": "<3.4", - "symfony/form": "<3.4.7|<4.0.7,>=4.0" + "symfony/form": "<3.4.9|<4.0.9,>=4.0" }, "require-dev": { "symfony/asset": "~3.4|~4.0", @@ -3399,7 +4157,7 @@ "symfony/dependency-injection": "~3.4|~4.0", "symfony/expression-language": "~3.4|~4.0", "symfony/finder": "~3.4|~4.0", - "symfony/form": "^3.4.7|^4.0.7", + "symfony/form": "^3.4.9|^4.0.9", "symfony/http-foundation": "~3.4|~4.0", "symfony/http-kernel": "~3.4|~4.0", "symfony/polyfill-intl-icu": "~1.0", @@ -3459,20 +4217,20 @@ ], "description": "Symfony Twig Bridge", "homepage": "https://symfony.com", - "time": "2018-04-02T14:06:14+00:00" + "time": "2018-04-30T16:59:37+00:00" }, { "name": "symfony/twig-bundle", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/twig-bundle.git", - "reference": "fdaa069cd5cf3918b03d10a5e5819b064451ee4c" + "reference": "f4f2ce9f9386bddff52bfb4110a28d2a4be7ea94" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bundle/zipball/fdaa069cd5cf3918b03d10a5e5819b064451ee4c", - "reference": "fdaa069cd5cf3918b03d10a5e5819b064451ee4c", + "url": "https://api.github.com/repos/symfony/twig-bundle/zipball/f4f2ce9f9386bddff52bfb4110a28d2a4be7ea94", + "reference": "f4f2ce9f9386bddff52bfb4110a28d2a4be7ea94", "shasum": "" }, "require": { @@ -3532,20 +4290,20 @@ ], "description": "Symfony TwigBundle", "homepage": "https://symfony.com", - "time": "2018-02-14T14:11:10+00:00" + "time": "2018-04-20T06:20:23+00:00" }, { "name": "symfony/validator", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "b9546d78133d6af199ac6625d0d587a2d804f967" + "reference": "87c2d527687f158368b3e890933fbb77178f3415" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/b9546d78133d6af199ac6625d0d587a2d804f967", - "reference": "b9546d78133d6af199ac6625d0d587a2d804f967", + "url": "https://api.github.com/repos/symfony/validator/zipball/87c2d527687f158368b3e890933fbb77178f3415", + "reference": "87c2d527687f158368b3e890933fbb77178f3415", "shasum": "" }, "require": { @@ -3616,20 +4374,20 @@ ], "description": "Symfony Validator Component", "homepage": "https://symfony.com", - "time": "2018-04-06T07:35:43+00:00" + "time": "2018-04-20T10:04:09+00:00" }, { "name": "symfony/yaml", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "8b34ebb5989df61cbd77eff29a02c4db9ac1069c" + "reference": "275ad099e4cbe612a2acbca14a16dd1c5311324d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/8b34ebb5989df61cbd77eff29a02c4db9ac1069c", - "reference": "8b34ebb5989df61cbd77eff29a02c4db9ac1069c", + "url": "https://api.github.com/repos/symfony/yaml/zipball/275ad099e4cbe612a2acbca14a16dd1c5311324d", + "reference": "275ad099e4cbe612a2acbca14a16dd1c5311324d", "shasum": "" }, "require": { @@ -3674,7 +4432,63 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2018-04-03T05:24:00+00:00" + "time": "2018-04-08T08:49:08+00:00" + }, + { + "name": "twig/extensions", + "version": "v1.5.1", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig-extensions.git", + "reference": "d188c76168b853481cc75879ea045bf93d718e9c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig-extensions/zipball/d188c76168b853481cc75879ea045bf93d718e9c", + "reference": "d188c76168b853481cc75879ea045bf93d718e9c", + "shasum": "" + }, + "require": { + "twig/twig": "~1.27|~2.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "~3.3@dev", + "symfony/translation": "~2.3|~3.0" + }, + "suggest": { + "symfony/translation": "Allow the time_diff output to be translated" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5-dev" + } + }, + "autoload": { + "psr-0": { + "Twig_Extensions_": "lib/" + }, + "psr-4": { + "Twig\\Extensions\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Common additional features for Twig that do not directly belong in core", + "homepage": "http://twig.sensiolabs.org/doc/extensions/index.html", + "keywords": [ + "i18n", + "text" + ], + "time": "2017-06-08T18:19:53+00:00" }, { "name": "twig/twig", @@ -3797,16 +4611,16 @@ }, { "name": "zendframework/zend-eventmanager", - "version": "3.2.0", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/zendframework/zend-eventmanager.git", - "reference": "9d72db10ceb6e42fb92350c0cb54460da61bd79c" + "reference": "a5e2583a211f73604691586b8406ff7296a946dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/9d72db10ceb6e42fb92350c0cb54460da61bd79c", - "reference": "9d72db10ceb6e42fb92350c0cb54460da61bd79c", + "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/a5e2583a211f73604691586b8406ff7296a946dd", + "reference": "a5e2583a211f73604691586b8406ff7296a946dd", "shasum": "" }, "require": { @@ -3815,7 +4629,7 @@ "require-dev": { "athletic/athletic": "^0.1", "container-interop/container-interop": "^1.1.0", - "phpunit/phpunit": "^6.0.7 || ^5.7.14", + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", "zendframework/zend-coding-standard": "~1.0.0", "zendframework/zend-stdlib": "^2.7.3 || ^3.0" }, @@ -3847,79 +4661,22 @@ "events", "zf2" ], - "time": "2017-07-11T19:17:22+00:00" + "time": "2018-04-25T15:33:34+00:00" } ], "packages-dev": [ - { - "name": "symfony/dotenv", - "version": "v4.0.8", - "source": { - "type": "git", - "url": "https://github.com/symfony/dotenv.git", - "reference": "afb6923923e22874dac20bd042167ccb8df1d158" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/dotenv/zipball/afb6923923e22874dac20bd042167ccb8df1d158", - "reference": "afb6923923e22874dac20bd042167ccb8df1d158", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "require-dev": { - "symfony/process": "~3.4|~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Dotenv\\": "" - }, - "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": "Registers environment variables from a .env file", - "homepage": "https://symfony.com", - "keywords": [ - "dotenv", - "env", - "environment" - ], - "time": "2018-01-03T17:15:19+00:00" - }, { "name": "symfony/polyfill-php72", - "version": "v1.7.0", + "version": "v1.8.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "8eca20c8a369e069d4f4c2ac9895144112867422" + "reference": "a4576e282d782ad82397f3e4ec1df8e0f0cafb46" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/8eca20c8a369e069d4f4c2ac9895144112867422", - "reference": "8eca20c8a369e069d4f4c2ac9895144112867422", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/a4576e282d782ad82397f3e4ec1df8e0f0cafb46", + "reference": "a4576e282d782ad82397f3e4ec1df8e0f0cafb46", "shasum": "" }, "require": { @@ -3928,7 +4685,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7-dev" + "dev-master": "1.8-dev" } }, "autoload": { @@ -3961,7 +4718,7 @@ "portable", "shim" ], - "time": "2018-01-31T17:43:24+00:00" + "time": "2018-04-26T10:06:28+00:00" }, { "name": "symfony/profiler-pack", @@ -3993,7 +4750,7 @@ }, { "name": "symfony/stopwatch", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", @@ -4042,16 +4799,16 @@ }, { "name": "symfony/var-dumper", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "e1b4d008100f4d203cc38b0d793ad6252d8d8af0" + "reference": "3c34cf3f4bbac9e003d9325225e9ef1a49180a18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/e1b4d008100f4d203cc38b0d793ad6252d8d8af0", - "reference": "e1b4d008100f4d203cc38b0d793ad6252d8d8af0", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/3c34cf3f4bbac9e003d9325225e9ef1a49180a18", + "reference": "3c34cf3f4bbac9e003d9325225e9ef1a49180a18", "shasum": "" }, "require": { @@ -4107,20 +4864,20 @@ "debug", "dump" ], - "time": "2018-04-04T05:10:37+00:00" + "time": "2018-04-26T16:12:06+00:00" }, { "name": "symfony/web-profiler-bundle", - "version": "v4.0.8", + "version": "v4.0.9", "source": { "type": "git", "url": "https://github.com/symfony/web-profiler-bundle.git", - "reference": "4f6a1f77120b5e4b37c59db34a8dc0a4d3df5cf0" + "reference": "1c961e84c5d51cae5ae326bc468c08bd9b1d5c9a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/4f6a1f77120b5e4b37c59db34a8dc0a4d3df5cf0", - "reference": "4f6a1f77120b5e4b37c59db34a8dc0a4d3df5cf0", + "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/1c961e84c5d51cae5ae326bc468c08bd9b1d5c9a", + "reference": "1c961e84c5d51cae5ae326bc468c08bd9b1d5c9a", "shasum": "" }, "require": { @@ -4173,13 +4930,12 @@ ], "description": "Symfony WebProfilerBundle", "homepage": "https://symfony.com", - "time": "2018-04-04T13:50:32+00:00" + "time": "2018-04-30T16:59:37+00:00" } ], "aliases": [], "minimum-stability": "stable", "stability-flags": { - "cdaguerre/php-trello-api": 20, "symfony/lts": 20 }, "prefer-stable": false, diff --git a/dailymail/config/bundles.php b/dailymail/config/bundles.php index b279d8b..819bfb3 100644 --- a/dailymail/config/bundles.php +++ b/dailymail/config/bundles.php @@ -9,4 +9,6 @@ Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true], Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], + Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], + EasyCorp\Bundle\EasyAdminBundle\EasyAdminBundle::class => ['all' => true], ]; diff --git a/dailymail/config/packages/easy_admin.yaml b/dailymail/config/packages/easy_admin.yaml new file mode 100644 index 0000000..2de1e57 --- /dev/null +++ b/dailymail/config/packages/easy_admin.yaml @@ -0,0 +1,14 @@ +easy_admin: + site_name: 'Daily Mail' + design: + color_scheme: 'dark' + brand_color: '#ff8054' + menu: + - { label: 'developper', icon: users, entity: Developper } + - { label: 'project' , icon: graduation-cap, entity: Project } + entities: + # List the entity class name you want to manage + Developper: + class: App\Entity\Developper + Project: + class: App\Entity\Project diff --git a/dailymail/config/packages/security.yaml b/dailymail/config/packages/security.yaml new file mode 100644 index 0000000..fb4c593 --- /dev/null +++ b/dailymail/config/packages/security.yaml @@ -0,0 +1,24 @@ +security: + # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers + providers: + in_memory: { memory: ~ } + firewalls: + dev: + pattern: ^/(_(profiler|wdt)|css|images|js)/ + security: false + main: + anonymous: true + + # activate different ways to authenticate + + # http_basic: true + # https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate + + # form_login: true + # https://symfony.com/doc/current/security/form_login_setup.html + + # Easy way to control access for large sections of your site + # Note: Only the *first* access control that matches will be used + access_control: + # - { path: ^/admin, roles: ROLE_ADMIN } + # - { path: ^/profile, roles: ROLE_USER } diff --git a/dailymail/config/packages/twig_extensions.yaml b/dailymail/config/packages/twig_extensions.yaml new file mode 100644 index 0000000..417b7bc --- /dev/null +++ b/dailymail/config/packages/twig_extensions.yaml @@ -0,0 +1,10 @@ +services: + _defaults: + public: false + autowire: true + autoconfigure: true + + #Twig\Extensions\ArrayExtension: ~ + #Twig\Extensions\DateExtension: ~ + #Twig\Extensions\IntlExtension: ~ + #Twig\Extensions\TextExtension: ~ diff --git a/dailymail/config/routes.yaml b/dailymail/config/routes.yaml index c3283aa..f1506bf 100644 --- a/dailymail/config/routes.yaml +++ b/dailymail/config/routes.yaml @@ -1,3 +1,8 @@ #index: # path: / # controller: App\Controller\DefaultController::index +easy_admin_bundle: + resource: "@EasyAdminBundle/Controller/AdminController.php" + type: annotation + prefix: /admin + diff --git a/dailymail/config/routes/easy_admin.yaml b/dailymail/config/routes/easy_admin.yaml new file mode 100644 index 0000000..1014c71 --- /dev/null +++ b/dailymail/config/routes/easy_admin.yaml @@ -0,0 +1,4 @@ +easy_admin_bundle: + resource: '@EasyAdminBundle/Controller/AdminController.php' + prefix: /admin + type: annotation diff --git a/dailymail/config/services.yaml b/dailymail/config/services.yaml index 469ac32..8c955c4 100644 --- a/dailymail/config/services.yaml +++ b/dailymail/config/services.yaml @@ -4,6 +4,7 @@ parameters: locale: 'en' trello.api_key: 'YOURTRELLOAPIKEY' trello.token: 'YOURTRELLOTOKEN' + google_sheet.token: 'WBtmaq7luGH2fr1P-AJ9MmD0' services: # default configuration for services in *this* file @@ -31,5 +32,9 @@ services: $trelloApiKey: '%trello.api_key%' $trelloToken: '%trello.token%' + App\Helper\GoogleSheetHelper: + arguments: + $googleSheetToken: '%google_sheet.token%' + # add more service definitions when explicit configuration is needed # please note that last definitions always *replace* previous ones diff --git a/dailymail/src/Controller/DevelopperController.php b/dailymail/src/Controller/DevelopperController.php index bc3e611..59d35c7 100644 --- a/dailymail/src/Controller/DevelopperController.php +++ b/dailymail/src/Controller/DevelopperController.php @@ -5,86 +5,13 @@ use App\Entity\Developper; use App\Form\DevelopperType; use App\Repository\DevelopperRepository; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Routing\Annotation\Route; +use JavierEguiluz\Bundle\EasyAdminBundle\Controller\AdminController; /** - * @Route("/developper") + * Class DevelopperController + * @package App\Controller */ -class DevelopperController extends Controller +class DevelopperController extends AdminController { - /** - * @Route("/", name="developper_index", methods="GET") - */ - public function index(DevelopperRepository $developperRepository): Response - { - return $this->render('Developper/index.html.twig', ['developpers' => $developperRepository->findAll()]); - } - /** - * @Route("/new", name="developper_new", methods="GET|POST") - */ - public function new(Request $request): Response - { - $developper = new Developper(); - $form = $this->createForm(DevelopperType::class, $developper); - $form->handleRequest($request); - - if ($form->isSubmitted() && $form->isValid()) { - $em = $this->getDoctrine()->getManager(); - $em->persist($developper); - $em->flush(); - - return $this->redirectToRoute('developper_index'); - } - - return $this->render('Developper/new.html.twig', [ - 'developper' => $developper, - 'form' => $form->createView(), - ]); - } - - /** - * @Route("/{id}", name="developper_show", methods="GET") - */ - public function show(Developper $developper): Response - { - return $this->render('Developper/show.html.twig', ['developper' => $developper]); - } - - /** - * @Route("/{id}/edit", name="developper_edit", methods="GET|POST") - */ - public function edit(Request $request, Developper $developper): Response - { - $form = $this->createForm(DevelopperType::class, $developper); - $form->handleRequest($request); - - if ($form->isSubmitted() && $form->isValid()) { - $this->getDoctrine()->getManager()->flush(); - - return $this->redirectToRoute('developper_edit', ['id' => $developper->getId()]); - } - - return $this->render('Developper/edit.html.twig', [ - 'developper' => $developper, - 'form' => $form->createView(), - ]); - } - - /** - * @Route("/{id}", name="developper_delete", methods="DELETE") - */ - public function delete(Request $request, Developper $developper): Response - { - if ($this->isCsrfTokenValid('delete'.$developper->getId(), $request->request->get('_token'))) { - $em = $this->getDoctrine()->getManager(); - $em->remove($developper); - $em->flush(); - } - - return $this->redirectToRoute('developper_index'); - } } diff --git a/dailymail/src/Controller/GoogleSheetController.php b/dailymail/src/Controller/GoogleSheetController.php new file mode 100644 index 0000000..1968bec --- /dev/null +++ b/dailymail/src/Controller/GoogleSheetController.php @@ -0,0 +1,39 @@ +getBoards(); + + $url = $googleSheetHelper->test(); + + return $this->render('google_sheet.html.twig', [ + 'chartUrl' => $url + ]); + } +} \ No newline at end of file diff --git a/dailymail/src/Controller/HomeController.php b/dailymail/src/Controller/HomeController.php index 3a65087..9dbfd84 100644 --- a/dailymail/src/Controller/HomeController.php +++ b/dailymail/src/Controller/HomeController.php @@ -1,24 +1,15 @@ getBoards(); - - return $this->render('home.html.twig'); - - } } \ No newline at end of file diff --git a/dailymail/src/Controller/ProjectController.php b/dailymail/src/Controller/ProjectController.php index fd3ff9d..98e5008 100644 --- a/dailymail/src/Controller/ProjectController.php +++ b/dailymail/src/Controller/ProjectController.php @@ -4,87 +4,13 @@ use App\Entity\Project; use App\Form\ProjectType; -use App\Repository\ProjectRepository; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Routing\Annotation\Route; +use JavierEguiluz\Bundle\EasyAdminBundle\Controller\AdminController; /** - * @Route("/project") + * Class ProjectController + * @package App\Controller */ -class ProjectController extends Controller +class ProjectController extends AdminController { - /** - * @Route("/", name="project_index", methods="GET") - */ - public function index(ProjectRepository $projectRepository): Response - { - return $this->render('project/index.html.twig', ['projects' => $projectRepository->findAll()]); - } - /** - * @Route("/new", name="project_new", methods="GET|POST") - */ - public function new(Request $request): Response - { - $project = new Project(); - $form = $this->createForm(ProjectType::class, $project); - $form->handleRequest($request); - - if ($form->isSubmitted() && $form->isValid()) { - $em = $this->getDoctrine()->getManager(); - $em->persist($project); - $em->flush(); - - return $this->redirectToRoute('project_index'); - } - - return $this->render('project/new.html.twig', [ - 'project' => $project, - 'form' => $form->createView(), - ]); - } - - /** - * @Route("/{id}", name="project_show", methods="GET") - */ - public function show(Project $project): Response - { - return $this->render('project/show.html.twig', ['project' => $project]); - } - - /** - * @Route("/{id}/edit", name="project_edit", methods="GET|POST") - */ - public function edit(Request $request, Project $project): Response - { - $form = $this->createForm(ProjectType::class, $project); - $form->handleRequest($request); - - if ($form->isSubmitted() && $form->isValid()) { - $this->getDoctrine()->getManager()->flush(); - - return $this->redirectToRoute('project_edit', ['id' => $project->getId()]); - } - - return $this->render('project/edit.html.twig', [ - 'project' => $project, - 'form' => $form->createView(), - ]); - } - - /** - * @Route("/{id}", name="project_delete", methods="DELETE") - */ - public function delete(Request $request, Project $project): Response - { - if ($this->isCsrfTokenValid('delete'.$project->getId(), $request->request->get('_token'))) { - $em = $this->getDoctrine()->getManager(); - $em->remove($project); - $em->flush(); - } - - return $this->redirectToRoute('project_index'); - } } diff --git a/dailymail/src/Entity/Developper.php b/dailymail/src/Entity/Developper.php index 2926be1..c26b865 100644 --- a/dailymail/src/Entity/Developper.php +++ b/dailymail/src/Entity/Developper.php @@ -33,11 +33,6 @@ class Developper */ private $email; - /** - * @ORM\ManyToOne(targetEntity="App\Entity\Project", inversedBy="developpers") - */ - private $project; - /** * @ORM\ManyToMany(targetEntity="App\Entity\Project", mappedBy="developpers") */ diff --git a/dailymail/src/Entity/Project.php b/dailymail/src/Entity/Project.php index f4ddfd8..ddf73e8 100644 --- a/dailymail/src/Entity/Project.php +++ b/dailymail/src/Entity/Project.php @@ -126,4 +126,14 @@ public function removeDevelopper(Developper $developper): self return $this; } + + /** + * @return string + */ + + public function __toString() + { + return $this->name; + } + } diff --git a/dailymail/src/Form/DevelopperType.php b/dailymail/src/Form/DevelopperType.php index 24b48d8..7d76b79 100644 --- a/dailymail/src/Form/DevelopperType.php +++ b/dailymail/src/Form/DevelopperType.php @@ -9,19 +9,5 @@ class DevelopperType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { - $builder - ->add('firstName') - ->add('lastName') - ->add('email') - ; - } - public function configureOptions(OptionsResolver $resolver) - { - $resolver->setDefaults([ - 'data_class' => Developper::class, - ]); - } } diff --git a/dailymail/src/Form/ProjectType.php b/dailymail/src/Form/ProjectType.php index 4959918..6d8d98c 100644 --- a/dailymail/src/Form/ProjectType.php +++ b/dailymail/src/Form/ProjectType.php @@ -9,21 +9,5 @@ class ProjectType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { - $builder - ->add('name') - ->add('customer') - ->add('trelloKey') - ->add('googleKey') - ->add('developpers') - ; - } - public function configureOptions(OptionsResolver $resolver) - { - $resolver->setDefaults([ - 'data_class' => Project::class, - ]); - } } diff --git a/dailymail/src/Helper/GoogleSheetHelper.php b/dailymail/src/Helper/GoogleSheetHelper.php new file mode 100644 index 0000000..0089aed --- /dev/null +++ b/dailymail/src/Helper/GoogleSheetHelper.php @@ -0,0 +1,84 @@ +googleSheetToken = $googleSheetToken; + } + + public function test() + { + // Get the API client and construct the service object. + $client = $this->getClient(); + $service = new \Google_Service_Sheets($client); + + // Prints the names and majors of students in a sample spreadsheet: + // https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit + $spreadsheetId = '1YZa7Kaf43sTTstlpNiu__Q8bz88tSlbDa3eypIAiGNw'; + $range = 'Sprint #0!A2:E'; + + $response = $service->spreadsheets->get($spreadsheetId); + + $sheetData = $response->getSheets(); + + $charts = array_filter(array_map( + function (\Google_Service_Sheets_Sheet $googleSheet) { + return $googleSheet->getCharts(); + }, + $sheetData + )); + + $charts = reset($charts); + + $chart = $charts[0]; + + $chartId = $chart->getChartId(); + + $url = "https://docs.google.com/spreadsheets/d/".$spreadsheetId."/embed/oimg?id=".$spreadsheetId."&oid=". $chartId ."&disposition=ATTACHMENT&bo=false&zx=9td6e8jgo6u3"; + + return $url; + } + + /** + * Returns an authorized API client. + * @return \Google_Client the authorized client object + */ + function getClient() { + $client = new \Google_Client(); + $client->setApplicationName('Google Sheets API PHP Quickstart'); +// $client->setScopes(implode(' ', array( +// \Google_Service_Sheets::SPREADSHEETS_READONLY) +// )); + +// $client->setAuthConfig(__DIR__. '/client_secret.json'); +// $client->setAccessType('offline'); + + $client->setDeveloperKey('AIzaSyCmGsMS1iwOFUWfc--0QH_PbBgOtP_EtLs'); + + return $client; + } + + /** + * Expands the home directory alias '~' to the full path. + * @param string $path the path to expand. + * @return string the expanded path. + */ + function expandHomeDirectory($path) { + $homeDirectory = getenv('HOME'); + if (empty($homeDirectory)) { + $homeDirectory = getenv('HOMEDRIVE') . getenv('HOMEPATH'); + } + return str_replace('~', realpath($homeDirectory), $path); + } +} \ No newline at end of file diff --git a/dailymail/src/Trello/Api/AbstractApi.php b/dailymail/src/Trello/Api/AbstractApi.php new file mode 100644 index 0000000..144ed7d --- /dev/null +++ b/dailymail/src/Trello/Api/AbstractApi.php @@ -0,0 +1,354 @@ + + * @author Joseph Bielawski + */ +abstract class AbstractApi implements ApiInterface +{ + /** + * API sub namespace + * + * @var string + */ + protected $path; + + /** + * The client + * + * @var Client + */ + protected $client; + + /** + * @var array + */ + public static $fields; + + /** + * @param Client $client + */ + public function __construct(Client $client) + { + $this->client = $client; + } + + /** + * Catches any undefined "get{$field}" calls, and passes them + * to the getField() if the $field is in the $this->fields property + * + * @param string $method called method + * @param array $arguments array of arguments passed to called method + * + * @return array + * + * @throws BadMethodCallException If the method does not start with "get" + * or the field is not included in the $fields property + */ + public function __call($method, $arguments) + { + if (isset($this->fields) && substr($method, 0, 3) === 'get') { + $property = lcfirst(substr($method, 3)); + if (in_array($property, $this->fields) && count($arguments) === 2) { + return $this->getField($arguments[0], $arguments[1]); + } + } + + throw new BadMethodCallException(sprintf( + 'There is no method named "%s" in class "%s".', + $method, + get_called_class() + )); + } + + /** + * Get field names (properties) + * + * @return array array of fields + */ + public function getFields() + { + return static::$fields; + } + + /** + * Get a field value by field name + * + * @param string $id the board's id + * @param string $field the field + * + * @return mixed field value + * + * @throws InvalidArgumentException If the field does not exist + */ + public function getField($id, $field) + { + if (!in_array($field, static::$fields)) { + throw new InvalidArgumentException(sprintf('There is no field named %s.', $field)); + } + + $response = $this->get($this->path.'/'.rawurlencode($id).'/'.rawurlencode($field)); + + return isset($response['_value']) ? $response['_value'] : $response; + } + + /** + * Send a GET request with query parameters. + * + * @param string $path Request path. + * @param array $parameters GET parameters. + * @param array $requestHeaders Request Headers. + * + * @return \Guzzle\Http\EntityBodyInterface|mixed|string + */ + protected function get($path, array $parameters = array(), $requestHeaders = array()) + { + $response = $this->client->getHttpClient()->get($path, $parameters, $requestHeaders); + + return ResponseMediator::getContent($response); + } + + /** + * Send a HEAD request with query parameters + * + * @param string $path Request path. + * @param array $parameters HEAD parameters. + * @param array $requestHeaders Request headers. + * + * @return \Guzzle\Http\Message\Response + */ + protected function head($path, array $parameters = array(), $requestHeaders = array()) + { + $response = $this->client->getHttpClient()->request($path, null, 'HEAD', $requestHeaders, array( + 'query' => $parameters, + )); + + return $response; + } + + /** + * Send a POST request with JSON-encoded parameters. + * + * @param string $path Request path. + * @param array $parameters POST parameters to be JSON encoded. + * @param array $requestHeaders Request headers. + * + * @return mixed + */ + protected function post($path, array $parameters = array(), $requestHeaders = array()) + { + return $this->postRaw( + $path, + $this->createParametersBody($parameters), + $requestHeaders + ); + } + + /** + * Send a POST request with raw data. + * + * @param string $path Request path. + * @param mixed $body Request body. + * @param array $requestHeaders Request headers. + * + * @return \Guzzle\Http\EntityBodyInterface|mixed|string + */ + protected function postRaw($path, $body, $requestHeaders = array()) + { + $response = $this->client->getHttpClient()->post( + $path, + $body, + $requestHeaders + ); + + return ResponseMediator::getContent($response); + } + + /** + * Send a PATCH request with JSON-encoded parameters. + * + * @param string $path Request path. + * @param array $parameters POST parameters to be JSON encoded. + * @param array $requestHeaders Request headers. + * + * @return mixed + */ + protected function patch($path, array $parameters = array(), $requestHeaders = array()) + { + $response = $this->client->getHttpClient()->patch( + $path, + $this->createParametersBody($parameters), + $requestHeaders + ); + + return ResponseMediator::getContent($response); + } + + /** + * Send a PUT request with JSON-encoded parameters. + * + * @param string $path Request path. + * @param array $parameters POST parameters to be JSON encoded. + * @param array $requestHeaders Request headers. + * + * @return mixed + */ + protected function put($path, array $parameters = array(), $requestHeaders = array()) + { + foreach ($parameters as $name => $parameter) { + if (is_bool($parameter)) { + $parameters[$name] = $parameter ? 'true' : 'false'; + } + } + + $response = $this->client->getHttpClient()->put( + $path, + $this->createParametersBody($parameters), + $requestHeaders + ); + + return ResponseMediator::getContent($response); + } + + /** + * Send a DELETE request with JSON-encoded parameters. + * + * @param string $path Request path. + * @param array $parameters POST parameters to be JSON encoded. + * @param array $requestHeaders Request headers. + * + * @return mixed + */ + protected function delete($path, array $parameters = array(), $requestHeaders = array()) + { + $response = $this->client->getHttpClient()->delete( + $path, + $this->createParametersBody($parameters), + $requestHeaders + ); + + return ResponseMediator::getContent($response); + } + + /** + * Prepare request parameters. + * + * @param array $parameters Request parameters + * + * @return null|string + */ + protected function createParametersBody(array $parameters) + { + foreach ($parameters as $name => $parameter) { + if (is_bool($parameter)) { + $parameters[$name] = $parameter ? 'true' : 'false'; + } elseif (is_array($parameter)) { + foreach ($parameter as $subName => $subParameter) { + if (is_bool($subParameter)) { + $subParameter = $subParameter ? 'true' : 'false'; + } + $parameters[$name.'/'.$subName] = $subParameter; + } + unset($parameters[$name]); + } elseif ($parameter instanceof DateTime) { + $parameters[$name] = $parameter->format($parameter::ATOM); + } + } + + return $parameters; + } + + protected function getPath($id = null) + { + if ($id) { + return preg_replace('/\#id\#/', $id, $this->path); + } + + return $this->path; + } + + /** + * Validate parameters array + * + * @param string[] $required required properties (array keys) + * @param array $params array to check for existence of the required keys + * + * @throws MissingArgumentException if a required parameter is missing + */ + protected function validateRequiredParameters(array $required, array $params) + { + foreach ($required as $param) { + if (!isset($params[$param])) { + throw new MissingArgumentException(sprintf('The "%s" parameter is required.', $param)); + } + } + } + + /** + * Validate allowed parameters array + * Checks whether the passed parameters are allowed + * + * @param string[] $allowed allowed properties + * @param array|string $params array to check + * @param string $paramName + * + * @return array array of validated parameters + * + * @throws InvalidArgumentException if a parameter is not allowed + */ + protected function validateAllowedParameters(array $allowed, $params, $paramName) + { + if (!is_array($params)) { + $params = array($params); + } + + foreach ($params as $param) { + if (!in_array($param, $allowed)) { + throw new InvalidArgumentException(sprintf( + 'The "%s" parameter may contain only values within "%s". "%s" given.', + $paramName, + implode(", ", $allowed), + $param + )); + } + } + + return $params; + } + + /** + * Validate that the params array includes at least one of + * the keys in a given array + * + * @param string[] $atLeastOneOf allowed properties + * @param array $params array to check + * + * @return boolean + * + * @throws MissingArgumentException + */ + protected function validateAtLeastOneOf(array $atLeastOneOf, array $params) + { + foreach ($atLeastOneOf as $param) { + if (isset($params[$param])) { + return true; + } + } + + throw new MissingArgumentException(sprintf( + 'You need to provide at least one of the following parameters "%s".', + implode('", "', $atLeastOneOf) + )); + } +} diff --git a/dailymail/src/Trello/Api/Action.php b/dailymail/src/Trello/Api/Action.php new file mode 100644 index 0000000..583d96b --- /dev/null +++ b/dailymail/src/Trello/Api/Action.php @@ -0,0 +1,279 @@ +get($this->getPath().'/'.rawurlencode($id), $params); + } + + /** + * Update a checklist + * @link https://trello.com/docs/api/checklist/#put-1-checklists-idchecklist + * + * @param string $id the list's id + * @param array $params list attributes to update + * + * @return array list info + */ + public function update($id, array $params = array()) + { + return $this->put($this->getPath().'/'.rawurlencode($id), $params); + } + + /** + * Remove a action + * @link https://trello.com/docs/api/action/#delete-1-actions-idaction + * + * @param string $id the action's id + * + * @return array + */ + public function remove($id) + { + return $this->delete($this->getPath().'/'.rawurlencode($id)); + } + + /** + * Get an action's board + * @link https://trello.com/docs/api/action/#get-1-actions-idaction-board + * + * @param string $id the action's id + * @param array $params optional parameters + * + * @return array + */ + public function getBoard($id, array $params = array()) + { + return $this->get($this->getPath().'/'.rawurlencode($id).'/board', $params); + } + + /** + * Get the field of a board of a given card + * @link https://trello.com/docs/api/action/#get-1-actions-idaction-board + * + * @param string $id the action's id + * @param array $field the name of the field + * + * @return array + * + * @throws InvalidArgumentException if the field does not exist + */ + public function getBoardField($id, $field) + { + $this->validateAllowedParameters(Board::$fields, $field, 'field'); + + return $this->get($this->getPath().'/'.rawurlencode($id).'/board/'.rawurlencode($field)); + } + + /** + * Get an action's list + * @link https://trello.com/docs/api/action/#get-1-actions-idaction-list + * + * @param string $id the action's id + * @param array $params optional parameters + * + * @return array + */ + public function getList($id, array $params = array()) + { + return $this->get($this->getPath().'/'.rawurlencode($id).'/list', $params); + } + + /** + * Get the field of a list of a given action + * @link https://trello.com/docs/api/action/index.html#get-1-actions-idaction-list-field + * + * @param string $id the action's id + * @param array $field the name of the field + * + * @return array + * + * @throws InvalidArgumentException if the field does not exist + */ + public function getListField($id, $field) + { + $this->validateAllowedParameters(Cardlist::$fields, $field, 'field'); + + return $this->get($this->getPath().'/'.rawurlencode($id).'/list/'.rawurlencode($field)); + } + + /** + * Get an action's card + * @link https://trello.com/docs/api/action/#get-1-actions-idaction-card + * + * @param string $id the action's id + * @param array $params optional parameters + * + * @return array + */ + public function getCard($id, array $params = array()) + { + return $this->get($this->getPath().'/'.rawurlencode($id).'/card', $params); + } + + /** + * Get the field of a card of a given action + * @link https://trello.com/docs/api/action/index.html#get-1-actions-idaction-card-field + * + * @param string $id the action's id + * @param array $field the name of the field + * + * @return array + * + * @throws InvalidArgumentException if the field does not exist + */ + public function getCardField($id, $field) + { + $this->validateAllowedParameters(Card::$fields, $field, 'field'); + + return $this->get($this->getPath().'/'.rawurlencode($id).'/card/'.rawurlencode($field)); + } + + /** + * Get an action's member + * @link https://trello.com/docs/api/action/#get-1-actions-idaction-member + * + * @param string $id the action's id + * @param array $params optional parameters + * + * @return array + */ + public function getMember($id, array $params = array()) + { + return $this->get($this->getPath().'/'.rawurlencode($id).'/member', $params); + } + + /** + * Get the field of a member of a given action + * @link https://trello.com/docs/api/action/#get-1-actions-idaction-member-field + * + * @param string $id the action's id + * @param array $field the name of the field + * + * @return array + * + * @throws InvalidArgumentException if the field does not exist + */ + public function getMemberField($id, $field) + { + $this->validateAllowedParameters(Member::$fields, $field, 'field'); + + return $this->get($this->getPath().'/'.rawurlencode($id).'/member/'.rawurlencode($field)); + } + + /** + * Get an action's creator + * @link https://trello.com/docs/api/action/#get-1-actions-idaction-creator + * + * @param string $id the action's id + * @param array $params optional parameters + * + * @return array + */ + public function getCreator($id, array $params = array()) + { + return $this->get($this->getPath().'/'.rawurlencode($id).'/memberCreator', $params); + } + + /** + * Get the field of a creator of a given action + * @link https://trello.com/docs/api/action/#get-1-actions-idaction-creator-field + * + * @param string $id the action's id + * @param array $field the name of the field + * + * @return array + * + * @throws InvalidArgumentException if the field does not exist + */ + public function getCreatorField($id, $field) + { + $this->validateAllowedParameters(Member::$fields, $field, 'field'); + + return $this->get($this->getPath().'/'.rawurlencode($id).'/memberCreator/'.rawurlencode($field)); + } + + /** + * Get an action's organization + * @link https://trello.com/docs/api/action/#get-1-actions-idaction-organization + * + * @param string $id the action's id + * @param array $params optional parameters + * + * @return array + */ + public function getOrganization($id, array $params = array()) + { + return $this->get($this->getPath().'/'.rawurlencode($id).'/organization', $params); + } + + /** + * Get the field of an organization of a given action + * @link https://trello.com/docs/api/action/#get-1-actions-idaction-organization-field + * + * @param string $id the action's id + * @param array $field the name of the field + * + * @return array + * + * @throws InvalidArgumentException if the field does not exist + */ + public function getOrganizationField($id, $field) + { + $this->validateAllowedParameters(Organization::$fields, $field, 'field'); + + return $this->get($this->getPath().'/'.rawurlencode($id).'/organization/'.rawurlencode($field)); + } + + /** + * Set a given action's text + * @link https://trello.com/docs/api/action/#put-1-actions-idaction-text + * + * @param string $id the card's id or short link + * @param string $text the text + * + * @return array card info + */ + public function setText($id, $text) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/text', array('value' => $text)); + } +} diff --git a/dailymail/src/Trello/Api/ApiInterface.php b/dailymail/src/Trello/Api/ApiInterface.php new file mode 100644 index 0000000..fd23a1e --- /dev/null +++ b/dailymail/src/Trello/Api/ApiInterface.php @@ -0,0 +1,10 @@ +get($this->getPath().'/'.rawurlencode($id), $params); + } + + /** + * Create a board + * @link https://trello.com/docs/api/board/#post-1-boards + * + * @param array $params attributes + * + * @return array board info + */ + public function create(array $params = array()) + { + $this->validateRequiredParameters(array('name'), $params); + + return $this->post($this->getPath(), $params); + } + + /** + * Update a board + * @link https://trello.com/docs/api/board/#put-1-boards + * + * @param string $id the board's id + * @param array $params board attributes to update + * + * @return array + */ + public function update($id, array $params = array()) + { + return $this->put($this->getPath().'/'.rawurlencode($id), $params); + } + + /** + * Set a given board's name + * @link https://trello.com/docs/api/board/#put-1-boards-board-id-name + * + * @param string $id the board's id + * @param string $name the name + * + * @return array + */ + public function setName($id, $name) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/name', array('value' => $name)); + } + + /** + * Set a given board's description + * @link https://trello.com/docs/api/board/#put-1-boards-board-id-desc + * + * @param string $id the board's id + * @param string $description the description + * + * @return array + */ + public function setDescription($id, $description) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/desc', array('value' => $description)); + } + + /** + * Set a given board's state + * @link https://trello.com/docs/api/board/#put-1-boards-board-id-closed + * + * @param string $id the board's id + * @param bool $closed whether the board should be closed or not + * + * @return array + */ + public function setClosed($id, $closed = true) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/closed', array('value' => $closed)); + } + + /** + * Set a given board's subscription state + * @link https://trello.com/docs/api/board/#put-1-boards-board-id-subscribed + * + * @param string $id the board's id + * @param bool $subscribed whether to subscribe to the board or not + * + * @return array + */ + public function setSubscribed($id, $subscribed = true) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/subscribed', array('value' => $subscribed)); + } + + /** + * Set a given board's organization + * @link https://trello.com/docs/api/board/#put-1-boards-board-id-organization + * + * @param string $id the board's id + * @param string $organizationId the organization's id + * + * @return array + */ + public function setOrganization($id, $organizationId) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/idOrganization/'.rawurlencode($organizationId)); + } + + /** + * Get a given board's organization + * @link https://trello.com/docs/api/board/#get-1-boards-board-id-organization + * + * @param string $id the board's id + * @param array $params optional parameters + * + * @return array + */ + public function getOrganization($id, array $params = array()) + { + return $this->get($this->getPath().'/'.rawurlencode($id).'/organization', $params); + } + + /** + * Get the field of the organization of a given board + * @link https://trello.com/docs/api/board/#get-1-boards-board-id-organization-field + * + * @param string $id the board's id + * @param string $field the organization's field name + * + * @return array + */ + public function getOrganizationField($id, $field) + { + $this->validateAllowedParameters(Organization::$fields, $field, 'field'); + + return $this->get($this->getPath().'/'.rawurlencode($id).'/organization/'.rawurlencode($field)); + } + + /** + * Get a given board's stars + * @link https://trello.com/docs/api/board/#get-1-boards-board-id-boardstars + * + * @param string $id the board's id + * @param array $params optional parameters + * + * @return array + */ + public function getStars($id, array $params = array()) + { + return $this->get($this->getPath().'/'.rawurlencode($id).'/boardStars', $params); + } + + /** + * Get a given board's deltas + * @link https://trello.com/docs/api/board/index.html#get-1-boards-board-id-deltas + * + * @param string $id the board's id + * @param array $params optional parameters + * + * @return array + */ + public function getDeltas($id, array $params = array()) + { + return $this->get($this->getPath().'/'.rawurlencode($id).'/deltas', $params); + } + + /** + * Mark a given board as viewed + * @link https://trello.com/docs/api/board/#post-1-boards-board-id-markasviewed + * + * @param string $id the board's id + * + * @return array + */ + public function setViewed($id) + { + return $this->post($this->getPath().'/'.rawurlencode($id).'/markAsViewed'); + } + + /** + * Board Actions API + * + * @return Board\Actions + */ + public function actions() + { + return new Board\Actions($this->client); + } + + /** + * Board Lists API + * + * @return Board\Cardlists + */ + public function lists() + { + return new Board\Cardlists($this->client); + } + + /** + * Board Cards API + * + * @return Board\Cards + */ + public function cards() + { + return new Board\Cards($this->client); + } + + /** + * Board Checklists API + * + * @return Board\Checklists + */ + public function checklists() + { + return new Board\Checklists($this->client); + } + + /** + * Board Labels API + * + * @return Board\Labels + */ + public function labels() + { + return new Board\Labels($this->client); + } + + /** + * Board Members API + * + * @return Board\Members + */ + public function members() + { + return new Board\Members($this->client); + } + + /** + * Board Memberships API + * + * @return Board\Memberships + */ + public function memberships() + { + return new Board\Memberships($this->client); + } + + /** + * Board Preferences API + * + * @return Board\Preferences + */ + public function preferences() + { + return new Board\Preferences($this->client); + } + + /** + * Board MyPreferences API + * + * @return Board\MyPreferences + */ + public function myPreferences() + { + return new Board\MyPreferences($this->client); + } + + /** + * Board PowerUps API + * + * @return Board\PowerUps + */ + public function powerUps() + { + return new Board\PowerUps($this->client); + } +} diff --git a/dailymail/src/Trello/Api/Board/Actions.php b/dailymail/src/Trello/Api/Board/Actions.php new file mode 100644 index 0000000..80fa908 --- /dev/null +++ b/dailymail/src/Trello/Api/Board/Actions.php @@ -0,0 +1,34 @@ +get($this->getPath($id), $params); + } +} diff --git a/dailymail/src/Trello/Api/Board/Cardlists.php b/dailymail/src/Trello/Api/Board/Cardlists.php new file mode 100644 index 0000000..a31a744 --- /dev/null +++ b/dailymail/src/Trello/Api/Board/Cardlists.php @@ -0,0 +1,66 @@ +get($this->getPath($id), $params); + } + + /** + * Filter card lists related to a given board + * @link https://trello.com/docs/api/board/#get-1-boards-board-id-lists-filter + * + * @param string $id the board's id + * @param string|array $filter array of / one of 'all', 'none', 'open', 'closed' + * + * @return array + */ + public function filter($id, $filter = 'all') + { + $allowed = array('all', 'none', 'open', 'closed'); + $filter = $this->validateAllowedParameters($allowed, $filter, 'filter'); + + return $this->get($this->getPath($id).'/'.implode(',', $filter)); + } + + /** + * Create a list on a given board + * @link https://trello.com/docs/api/board/#post-1-boards-board-id-lists + * + * @param array $params + * + * @return array + */ + public function create($id, array $params = array()) + { + $this->validateRequiredParameters(array('name'), $params); + + return $this->post($this->getPath($id), $params); + } +} diff --git a/dailymail/src/Trello/Api/Board/Cards.php b/dailymail/src/Trello/Api/Board/Cards.php new file mode 100644 index 0000000..9ee90a3 --- /dev/null +++ b/dailymail/src/Trello/Api/Board/Cards.php @@ -0,0 +1,65 @@ +get($this->getPath($id), $params); + } + + /** + * Filter cards related to a given board + * @link https://trello.com/docs/api/board/#get-1-boards-board-id-cards-filter + * + * @param string $id the board's id + * @param string|array $filter array of / one of 'all', 'visible', 'none', 'open', 'closed' + * + * @return array + */ + public function filter($id, $filter = 'all') + { + $allowed = array('all', 'visible', 'none', 'open', 'closed'); + $filter = $this->validateAllowedParameters($allowed, $filter, 'filter'); + + return $this->get($this->getPath($id).'/'.implode(',', $filter)); + } + + /** + * Get a card related to a given board + * @link https://trello.com/docs/api/board/#get-1-boards-board-id-cards-idcard + * + * @param string $id the board's id + * @param string $cardId the card's id + * + * @return array + */ + public function show($id, $cardId) + { + return $this->get($this->getPath($id).'/'.rawurlencode($cardId)); + } +} diff --git a/dailymail/src/Trello/Api/Board/Checklists.php b/dailymail/src/Trello/Api/Board/Checklists.php new file mode 100644 index 0000000..988d008 --- /dev/null +++ b/dailymail/src/Trello/Api/Board/Checklists.php @@ -0,0 +1,50 @@ +get($this->getPath($id), $params); + } + + /** + * Add an checklist to a given board + * @link https://trello.com/docs/api/board/#post-1-boards-board-id-checklists + * + * @param string $id the board's id + * @param array $params optional parameters + * + * @return array + */ + public function create($id, array $params) + { + $this->validateRequiredParameters(array('name'), $params); + + return $this->post($this->getPath($id), $params); + } +} diff --git a/dailymail/src/Trello/Api/Board/Labels.php b/dailymail/src/Trello/Api/Board/Labels.php new file mode 100644 index 0000000..3d3cd94 --- /dev/null +++ b/dailymail/src/Trello/Api/Board/Labels.php @@ -0,0 +1,87 @@ +get($this->getPath($id), $params); + } + + /** + * Get a label related to a given board + * @link https://trello.com/docs/api/board/#get-1-boards-board-id-labels-idlabel + * + * @param string $id the board's id + * @param string $color the label's color + * + * @return array + */ + public function show($id, $color) + { + $colors = array('blue', 'green', 'orange', 'purple', 'red', 'yellow'); + + if (!in_array($color, $colors)) { + throw new InvalidArgumentException(sprintf( + 'The "color" parameter must be one of "%s".', + implode(", ", $colors) + )); + } + + return $this->get($this->getPath($id).'/'.rawurlencode($color)); + } + + /** + * Set a label's name on a given board and for a given color + * @link https://trello.com/docs/api/board/#put-1-boards-board-id-labelnames-blue + * @link https://trello.com/docs/api/board/#put-1-boards-board-id-labelnames-green + * @link https://trello.com/docs/api/board/#put-1-boards-board-id-labelnames-orange + * @link https://trello.com/docs/api/board/#put-1-boards-board-id-labelnames-purple + * @link https://trello.com/docs/api/board/#put-1-boards-board-id-labelnames-red + * @link https://trello.com/docs/api/board/#put-1-boards-board-id-labelnames-yellow + * + * @param string $id the board's id + * @param string $color the label color to set the name of + * @param string $name + * + * @return array + */ + public function setName($id, $color, $name) + { + $colors = array('blue', 'green', 'orange', 'purple', 'red', 'yellow'); + + if (!in_array($color, $colors)) { + throw new InvalidArgumentException(sprintf( + 'The "color" parameter must be one of "%s".', + implode(", ", $colors) + )); + } + + return $this->put('boards/'.rawurlencode($id).'/labelNames/'.rawurlencode($color), array('value' => $name)); + } +} diff --git a/dailymail/src/Trello/Api/Board/Members.php b/dailymail/src/Trello/Api/Board/Members.php new file mode 100644 index 0000000..fdbaf5e --- /dev/null +++ b/dailymail/src/Trello/Api/Board/Members.php @@ -0,0 +1,171 @@ +get($this->getPath($id), $params); + } + + /** + * Remove a given member from a given board + * @link https://trello.com/docs/api/board/#get-1-boards-board-id-members + * + * @param string $id the board's id + * @param string $memberId the member's id + * + * @return array + */ + public function remove($id, $memberId) + { + return $this->delete($this->getPath($id).'/'.$memberId); + } + + /** + * Filter members related to a given board + * @link https://trello.com/docs/api/board/#get-1-boards-board-id-members-filter + * + * @param string $id the board's id + * @param string|array $filter array of / one of 'none', 'normal', 'admins', 'owners', 'all' + * + * @return array + */ + public function filter($id, $filter = 'all') + { + $allowed = array('none', 'normal', 'admins', 'owners', 'all'); + $filters = $this->validateAllowedParameters($allowed, $filter, 'filter'); + + return $this->get($this->getPath($id).'/'.implode(',', $filters)); + } + + /** + * Get a member's cards related to a given board + * @link https://trello.com/docs/api/board/#get-1-boards-board-id-members-filter + * + * @param string $id the board's id + * @param string $memberId the member's id + * @param array $params optional parameters + * + * @return array + */ + public function cards($id, $memberId, array $params = array()) + { + return $this->get($this->getPath($id).'/'.rawurlencode($memberId).'/cards', $params); + } + + /** + * Add member to a given board + * @link https://trello.com/docs/api/board/#put-1-boards-board-id-members + * + * @param string $id the board's id + * @param string $email the member's email address + * @param string $fullName the member's full name + * @param string $role one of 'normal', 'observer' or 'admin' + * + * @return array + */ + public function invite($id, $email, $fullName, $role = 'normal') + { + $roles = array('normal', 'observer', 'admin'); + + if (!in_array($role, $roles)) { + throw new InvalidArgumentException(sprintf( + 'The "role" parameter must be one of "%s".', + implode(", ", $roles) + )); + } + + $params = array( + 'email' => $email, + 'fullName' => $fullName, + 'type' => $role, + ); + + return $this->put($this->getPath($id), $params); + } + + /** + * Get members invited to a given board + * @link https://trello.com/docs/api/board/#get-1-boards-board-id-membersinvited + * + * @param string $id the board's id + * @param array $params optional parameters + * + * @return array + */ + public function getInvitedMembers($id, array $params = array()) + { + return $this->get($this->getPath($id).'Invited', $params); + } + + /** + * Get a field related to a member invited to a given board + * @link https://trello.com/docs/api/board/#get-1-boards-board-id-membersinvited-field + * + * @param string $id the board's id + * @param string $field the member's field name + * + * @return array + */ + public function getInvitedMembersField($id, $field) + { + $this->validateAllowedParameters(Member::$fields, $field, 'field'); + + return $this->get($this->getPath($id).'Invited/'.rawurlencode($field)); + } + + /** + * Set the role of a user or an organization on a given board + * @link https://trello.com/docs/api/board/index.html#put-1-boards-board-id-members-idmember + * + * @param string $id the board's id + * @param string $memberOrOrganization the member's id, user name or an organization name + * + * @return array + */ + public function setRole($id, $memberOrOrganization, $role) + { + $roles = array('normal', 'observer', 'admin'); + + if (!in_array($role, $roles)) { + throw new InvalidArgumentException(sprintf( + 'The "role" parameter must be one of "%s".', + implode(", ", $roles) + )); + } + + $params = array( + 'idMember' => $memberOrOrganization, + 'type' => $role, + ); + + return $this->post($this->getPath($id).'/'.rawurlencode($memberOrOrganization), $params); + } +} diff --git a/dailymail/src/Trello/Api/Board/Memberships.php b/dailymail/src/Trello/Api/Board/Memberships.php new file mode 100644 index 0000000..a8e052a --- /dev/null +++ b/dailymail/src/Trello/Api/Board/Memberships.php @@ -0,0 +1,23 @@ +get($this->getPath().'/'.rawurlencode($id), $params); + } + + /** + * Create a card + * @link https://trello.com/docs/api/card/#post-1-cards + * + * @param array $params optional attributes + * + * @return array card info + */ + public function create(array $params = array()) + { + $this->validateRequiredParameters(array('idList', 'name'), $params); + + if (!array_key_exists('due', $params)) { + $params['due'] = null; + } + if (!array_key_exists('urlSource', $params)) { + $params['urlSource'] = null; + } + + return $this->post($this->getPath(), $params); + } + + /** + * Update a card + * @link https://trello.com/docs/api/card/#put-1-cards + * + * @param string $id the card's id or short link + * @param array $params card attributes to update + * + * @return array card info + */ + public function update($id, array $params = array()) + { + return $this->put($this->getPath().'/'.rawurlencode($id), $params); + } + + /** + * Set a given card's board + * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-idboard + * + * @param string $id the card's id or short link + * @param string $boardId the board's id + * + * @return array board info + */ + public function setBoard($id, $boardId) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/idBoard', array('value' => $boardId)); + } + + /** + * Get a given card's board + * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-idboard + * + * @param string $id the card's id or short link + * @param array $params optional parameters + * + * @return array board info + */ + public function getBoard($id, array $params = array()) + { + return $this->get($this->getPath().'/'.rawurlencode($id).'/board', $params); + } + + /** + * Get the field of a board of a given card + * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-board-field + * + * @param string $id the card's id + * @param array $field the name of the field + * + * @return array board info + * + * @throws InvalidArgumentException if the field does not exist + */ + public function getBoardField($id, $field) + { + $this->validateAllowedParameters(Board::$fields, $field, 'field'); + + return $this->get($this->getPath().'/'.rawurlencode($id).'/board/'.rawurlencode($field)); + } + + /** + * Set a given card's list + * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-idlist + * + * @param string $id the card's id or short link + * @param string $listId the list's id + * + * @return array list info + */ + public function setList($id, $listId) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/idList', array('value' => $listId)); + } + + /** + * Get a given card's list + * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-list + * + * @param string $id the card's id or short link + * @param array $params optional parameters + * + * @return array list info + */ + public function getList($id, array $params = array()) + { + return $this->get($this->getPath().'/'.rawurlencode($id).'/list', $params); + } + + /** + * Get the field of a list of a given card + * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-list-field + * + * @param string $id the card's id + * @param array $field the name of the field + * + * @return array board info + * + * @throws InvalidArgumentException if the field does not exist + */ + public function getListField($id, $field) + { + $this->validateAllowedParameters(Cardlist::$fields, $field, 'field'); + + return $this->get($this->getPath().'/'.rawurlencode($id).'/list/'.rawurlencode($field)); + } + + /** + * Set a given card's name + * @link https://trello.com/docs/api/card/#put-1-cards-card-id-name + * + * @param string $id the card's id or short link + * @param string $name the name + * + * @return array card info + */ + public function setName($id, $name) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/name', array('value' => $name)); + } + + /** + * Set a given card's description + * @link https://trello.com/docs/api/card/#put-1-cards-card-id-desc + * + * @param string $id the card's id or short link + * @param string $description the description + * + * @return array card info + */ + public function setDescription($id, $description) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/desc', array('value' => $description)); + } + + /** + * Set a given card's state + * @link https://trello.com/docs/api/card/#put-1-cards-card-id-closed + * + * @param string $id the card's id or short link + * @param bool $closed whether the card should be closed or not + * + * @return array card info + */ + public function setClosed($id, $closed = true) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/closed', array('value' => $closed)); + } + + /** + * Set a given card's due date + * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-due + * + * @param string $id the card's id or short link + * @param \DateTime $date the due date + * + * @return array card info + */ + public function setDueDate($id, \DateTime $date = null) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/due', array('value' => $date)); + } + + /** + * Set a given card's position + * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-pos + * + * @param string $id the card's id or short link + * @param string|integer $position the position, eg. 'top', 'bottom' + * or a positive number + * + * @return array card info + */ + public function setPosition($id, $position) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/pos', array('value' => $position)); + } + + /** + * Set a given card's subscription state + * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-subscribed + * + * @param string $id the list's id + * @param bool $subscribed subscription state + * + * @return array list info + */ + public function setSubscribed($id, $subscribed) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/subscribed', array('value' => $subscribed)); + } + + /** + * Actions API + * + * @return Card\Actions + */ + public function actions() + { + return new Card\Actions($this->client); + } + + /** + * Attachments API + * + * @return Card\Attachments + */ + public function attachments() + { + return new Card\Attachments($this->client); + } + + /** + * Checklists API + * + * @return Card\Checklists + */ + public function checklists() + { + return new Card\Checklists($this->client); + } + + /** + * Labels API + * + * @return Card\Labels + */ + public function labels() + { + return new Card\Labels($this->client); + } + + /** + * Members API + * + * @return Card\Members + */ + public function members() + { + return new Card\Members($this->client); + } + + /** + * Stickers API + * + * @return Card\Stickers + */ + public function stickers() + { + return new Card\Stickers($this->client); + } +} diff --git a/dailymail/src/Trello/Api/Card/Actions.php b/dailymail/src/Trello/Api/Card/Actions.php new file mode 100644 index 0000000..c916dbf --- /dev/null +++ b/dailymail/src/Trello/Api/Card/Actions.php @@ -0,0 +1,58 @@ +get($this->getPath($id), $params); + } + + /** + * Add comment to a given card + * @link https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-actions-comments + * + * @param string $id the card's id or short link + * @param string $text comment message + * + * @return array + */ + public function addComment($id, $text) + { + return $this->post($this->getPath($id).'/comments', array('text' => $text)); + } + + /** + * Remove comment to a given card + * @link https://trello.com/docs/api/card/#delete-1-cards-card-id-or-shortlink-actions-idaction-comments + * + * @param string $id the card's id or short link + * @param string $commentId the comment's id + * + * @return array + */ + public function removeComment($id, $commentId) + { + return $this->delete($this->getPath($id).'/comments/'.rawurlencode($commentId)); + } +} diff --git a/dailymail/src/Trello/Api/Card/Attachments.php b/dailymail/src/Trello/Api/Card/Attachments.php new file mode 100644 index 0000000..e2fac02 --- /dev/null +++ b/dailymail/src/Trello/Api/Card/Attachments.php @@ -0,0 +1,89 @@ +get($this->getPath($id), $params); + } + + /** + * Add an attachment to a given card + * @link https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-attachments + * + * @param string $id the card's id or short link + * @param array $params optional parameters + * + * @return array + */ + public function create($id, array $params) + { + $atLeastOneOf = array('url', 'file'); + $this->validateAtLeastOneOf($atLeastOneOf, $params); + + return $this->post($this->getPath($id), $params); + } + + /** + * Get a given attachment on a given card + * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-attachments-idattachment + * + * @param string $id the card's id or short link + * @param string $attachmentId the attachment's id + * + * @return array + */ + public function show($id, $attachmentId) + { + return $this->get($this->getPath($id).'/'.rawurlencode($attachmentId)); + } + + /** + * Remove a given attachment from a given card + * @link https://trello.com/docs/api/card/#delete-1-cards-card-id-or-shortlink-attachments-idattachment + * + * @param string $id the card's id or short link + * @param string $attachmentId the attachment's id + * + * @return array + */ + public function remove($id, $attachmentId) + { + return $this->delete($this->getPath($id).'/'.rawurlencode($attachmentId)); + } + + /** + * Set a given attachment as cover of a given card + * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-idattachmentcover + * + * @param string $id the card's id or short link + * @param string $attachmentId the attachment's id + * + * @return array + */ + public function setAsCover($id, $attachmentId) + { + return $this->put('cards/'.rawurlencode($id).'/idAttachmentCover', array('value' => $attachmentId)); + } +} diff --git a/dailymail/src/Trello/Api/Card/Checklists.php b/dailymail/src/Trello/Api/Card/Checklists.php new file mode 100644 index 0000000..eee289e --- /dev/null +++ b/dailymail/src/Trello/Api/Card/Checklists.php @@ -0,0 +1,153 @@ +get('cards/'.rawurlencode($id).'/checklists', $params); + } + + /** + * Add a checklist to a given card + * @link https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-checklists + * + * @param string $id the card's id or short link + * @param array $params All parameters are optional, but at least one has to be provided: + * - value : id of the checklist to add, or null to create a new one. + * - name : the checklist's name + * - idChecklistSource : id of the source checklist to copy + * + * @return array + * + * @throws MissingArgumentException If there is not at least of the + * following parameters: 'value', 'name', 'idChecklistSource' + */ + public function create($id, array $params) + { + $atLeastOneOf = array('value', 'name', 'idChecklistSource'); + $this->validateAtLeastOneOf($atLeastOneOf, $params); + + return $this->post($this->getPath($id), $params); + } + + /** + * Remove a given checklist from a given card + * @link https://trello.com/docs/api/card/#delete-1-cards-card-id-or-shortlink-checklists-idchecklist + * + * @param string $id the card's id or short link + * @param string $checklistId the checklist's id + * + * @return array + */ + public function remove($id, $checklistId) + { + return $this->delete($this->getPath($id).'/'.rawurlencode($checklistId)); + } + + /** + * Get a given card's checklist item states + * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-checkitemstates + * + * @param string $id the card's id or short link + * + * @return array + */ + public function itemStates($id, array $params = array()) + { + return $this->get('cards/'.rawurlencode($id).'/checkItemStates', $params); + } + + /** + * Update a given check item + * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-checklist-idchecklistcurrent-checkitem-idcheckitem + * + * @param string $id the card's id or short link + * @param string $checklistId the checklist's id + * @param string $checkItemId the check item's id + * @param array $data check item data + * + * @return array + */ + public function updateItem($id, $checklistId, $checkItemId, array $data) + { + return $this->put( + $this->getPath($id).'/'.rawurlencode($checklistId).'/checkItem/'.rawurlencode($checkItemId), + $data + ); + } + + /** + * Create a check item + * @link https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem + * + * @param string $id the card's id or short link + * @param string $checklistId the checklist's id + * @param string $name check item name + * @param array $data check item data + * + * @return array + */ + public function createItem($id, $checklistId, $name, array $data = array()) + { + $data['idChecklist'] = $checklistId; + $data['name'] = $name; + + return $this->post($this->getPath($id).'/'.rawurlencode($checklistId).'/checkItem', $data); + } + + /** + * Convert a check item to card + * @link https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem + * + * @param string $id the card's id or short link + * @param string $checklistId the checklist's id + * @param string $checkItemId the check item's id + * + * @return array + */ + public function convertItemToCard($id, $checklistId, $checkItemId) + { + return $this->post( + $this->getPath($id).'/'.rawurlencode($checklistId).'/checkItem/'.rawurlencode($checkItemId).'/convertToCard' + ); + } + + /** + * Remove a check item from card + * @link https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem + * + * @param string $id the card's id or short link + * @param string $checklistId the checklist's id + * @param string $checkItemId the check item's id + * + * @return array + */ + public function removeItem($id, $checklistId, $checkItemId) + { + return $this->delete( + $this->getPath($id).'/'.rawurlencode($checklistId).'/checkItem/'.rawurlencode($checkItemId) + ); + } +} diff --git a/dailymail/src/Trello/Api/Card/Labels.php b/dailymail/src/Trello/Api/Card/Labels.php new file mode 100644 index 0000000..947ea38 --- /dev/null +++ b/dailymail/src/Trello/Api/Card/Labels.php @@ -0,0 +1,61 @@ +put($this->getPath($id), array('value' => $labels)); + } + + /** + * Remove a given label from a given card + * @link https://trello.com/docs/api/card/#delete-1-cards-card-id-or-shortlink-labels-color + * + * @param string $id the card's id or short link + * @param string $label the label to remove + * + * @return array card info + * + * @throws InvalidArgumentException If a label does not exist + */ + public function remove($id, $label) + { + if (!in_array($label, array('green', 'yellow', 'orange', 'red', 'purple', 'blue'))) { + throw new InvalidArgumentException(sprintf('Label "%s" does not exist.', $label)); + } + + return $this->delete($this->getPath($id).'/'.rawurlencode($label)); + } +} diff --git a/dailymail/src/Trello/Api/Card/Members.php b/dailymail/src/Trello/Api/Card/Members.php new file mode 100644 index 0000000..331962d --- /dev/null +++ b/dailymail/src/Trello/Api/Card/Members.php @@ -0,0 +1,107 @@ +get($this->getPath($id), $params); + } + + /** + * Set members of a given card + * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-idmembers + * + * @param string $id the card's id or short link + * @param array $members An array of member ids + * + * @return array + */ + public function set($id, array $members) + { + if (!count($members)) { + throw new InvalidArgumentException('You must specify at least one member id.'); + } + + $members = implode(',', $members); + + return $this->put($this->getPath($id), array('value' => $members)); + } + + /** + * Add a member to a given card + * @link https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-idmembers + * + * @param string $id the card's id or short link + * @param array $memberId the member's id + * + * @return array + */ + public function add($id, $memberId) + { + return $this->post($this->getPath($id), array('value' => $memberId)); + } + + /** + * Remove a given member from a given card + * @link https://trello.com/docs/api/card/#delete-1-cards-card-id-or-shortlink-idmembers-idmember + * + * @param string $id the card's id or short link + * @param string $memberId the members's id + * + * @return array + */ + public function remove($id, $memberId) + { + return $this->delete($this->getPath($id).'/'.rawurlencode($memberId)); + } + + /** + * Add a given member's vote to a given card + * @link https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-membersvoted + * + * @param string $id the card's id or short link + * @param string $memberId the members's id + * + * @return array + */ + public function addVote($id, $memberId) + { + return $this->post($this->getPath($id).'/membersVoted', array('value' => $memberId)); + } + + /** + * Remove a given member's vote from a given card + * @link https://trello.com/docs/api/card/#delete-1-cards-card-id-or-shortlink-membersvoted-idmember + * + * @param string $id the card's id or short link + * @param string $memberId the members's id + * + * @return array + */ + public function removeVote($id, $memberId) + { + return $this->delete($this->getPath($id).'/membersVoted/'.rawurlencode($memberId)); + } +} diff --git a/dailymail/src/Trello/Api/Card/Stickers.php b/dailymail/src/Trello/Api/Card/Stickers.php new file mode 100644 index 0000000..db229c7 --- /dev/null +++ b/dailymail/src/Trello/Api/Card/Stickers.php @@ -0,0 +1,113 @@ +get($this->getPath($id), $params); + } + + /** + * Get a given sticker on a given card + * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-stickers-idsticker + * + * @param string $id the card's id or short link + * @param string $stickerId the sticker's id + * @param string|array $fields 'all' or a array of: + * - image + * - imageScaled + * - imageUrl + * - left + * - rotate + * - top + * - zIndex + * Defaults to 'all' + * + * @return array + */ + public function show($id, $stickerId, $fields = 'all') + { + $allowed = array('all', 'image', 'imageScaled', 'imageUrl', 'left', 'rotate', 'top', 'zIndex'); + $fields = $this->validateAllowedParameters($allowed, $fields, 'field'); + + return $this->get($this->getPath($id).'/'.rawurlencode($stickerId), $fields); + } + + /** + * Update a given sticker on a given card + * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-stickers-idsticker + * + * @param string $id the card's id or short link + * @param string $stickerId the sticker's id + * @param array $params Parameters to update (all optional but at least one of them is required): + * - left + * - rotate + * - top + * - zIndex + * + * @return array + */ + public function update($id, $stickerId, array $params) + { + $oneOf = array('left', 'rotate', 'top', 'zIndex'); + $this->validateAtLeastOneOf($oneOf, $params); + + return $this->put($this->getPath($id).'/'.rawurlencode($stickerId), $params); + } + + /** + * Create a given sticker on a given card + * @link https://trello.com/docs/api/card/#put-1-cards-card-id-or-shortlink-stickers-idsticker + * + * @param string $id the card's id or short link + * @param array $params Properties of the sticker + * - image (string) + * - top + * - left + * - zIndex + * - rotate (optional, default 0) + * @return array + */ + public function create($id, array $params) + { + $required = array('image', 'left', 'top', 'zIndex'); + $this->validateRequiredParameters($required, $params); + + return $this->post($this->getPath($id), $params); + } + + /** + * Remove a given sticker from a given card + * @link https://trello.com/docs/api/card/#delete-1-cards-card-id-or-shortlink-stickers-idsticker + * + * @param string $id the card's id or short link + * @param string $stickerId the sticker's id + * + * @return array + */ + public function remove($id, $stickerId) + { + return $this->delete($this->getPath($id).'/'.rawurlencode($stickerId)); + } +} diff --git a/dailymail/src/Trello/Api/Cardlist.php b/dailymail/src/Trello/Api/Cardlist.php new file mode 100644 index 0000000..38ac832 --- /dev/null +++ b/dailymail/src/Trello/Api/Cardlist.php @@ -0,0 +1,200 @@ +get($this->getPath().'/'.rawurlencode($id), $params); + } + + /** + * Create a list + * @link https://trello.com/docs/api/list/#post-1-lists + * + * @param array $params Required attributes: 'name', 'idBoard' + * Optional attributes: 'pos' + * + * @return array + */ + public function create(array $params = array()) + { + $this->validateRequiredParameters(array('name', 'idBoard'), $params); + + return $this->post($this->getPath(), $params); + } + + /** + * Update a list + * @link https://trello.com/docs/api/list/#put-1-lists-idlist + * + * @param string $id the list's id + * @param array $params list attributes to update + * + * @return array list info + */ + public function update($id, array $params = array()) + { + return $this->put($this->getPath().'/'.rawurlencode($id), $params); + } + + /** + * Set a given list's board + * @link https://trello.com/docs/api/list/#put-1-lists-idlist-idboard + * + * @param string $id the list's id + * @param string $boardId the board's id + * + * @return array board info + */ + public function setBoard($id, $boardId) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/idBoard', array('value' => $boardId)); + } + + /** + * Get a given list's board + * @link https://trello.com/docs/api/list/#get-1-lists-idlist-board + * + * @param string $id the list's id + * @param array $params optional parameters + * + * @return array board info + */ + public function getBoard($id, array $params = array()) + { + return $this->get($this->getPath().'/'.rawurlencode($id).'/board', $params); + } + + /** + * Get the field of a board of a given list + * @link https://trello.com/docs/api/list/#get-1-lists-idlist-board-field + * + * @param string $id the list's id + * @param array $field the name of the field + * + * @return array + * + * @throws InvalidArgumentException if the field does not exist + */ + public function getBoardField($id, $field) + { + $this->validateAllowedParameters(Board::$fields, $field, 'field'); + + return $this->get($this->getPath().'/'.rawurlencode($id).'/board/'.rawurlencode($field)); + } + + /** + * Set a given list's name + * @link https://trello.com/docs/api/list/#put-1-lists-idlist-name + * + * @param string $id the list's id + * @param string $name the name + * + * @return array list info + */ + public function setName($id, $name) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/name', array('value' => $name)); + } + + /** + * Set a given list's description + * @link https://trello.com/docs/api/list/#put-1-lists-list-id-desc + * + * @param string $id the list's id + * @param bool $subscribed subscription state + * + * @return array list info + */ + public function setSubscribed($id, $subscribed) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/subscribed', array('value' => $subscribed)); + } + + /** + * Set a given list's state + * @link https://trello.com/docs/api/list/#put-1-lists-idlist-closed + * + * @param string $id the list's id + * @param bool $closed whether the list should be closed or not + * + * @return array list info + */ + public function setClosed($id, $closed = true) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/closed', array('value' => $closed)); + } + + /** + * Set a given list's position + * @link https://trello.com/docs/api/list/#put-1-lists-idlist-pos + * + * @param string $id the list's id + * @param string|integer $position the position, eg. 'top', 'bottom' + * or a positive number + * + * @return array list info + */ + public function setPosition($id, $position) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/pos', array('value' => $position)); + } + + /** + * Actions API + * + * @return Cardlist\Actions + */ + public function actions() + { + return new Cardlist\Actions($this->client); + } + + /** + * Cards API + * + * @return Cardlist\Cards + */ + public function cards() + { + return new Cardlist\Cards($this->client); + } +} diff --git a/dailymail/src/Trello/Api/Cardlist/Actions.php b/dailymail/src/Trello/Api/Cardlist/Actions.php new file mode 100644 index 0000000..fbff211 --- /dev/null +++ b/dailymail/src/Trello/Api/Cardlist/Actions.php @@ -0,0 +1,30 @@ +get($this->getPath($id), $params); + } +} diff --git a/dailymail/src/Trello/Api/Cardlist/Cards.php b/dailymail/src/Trello/Api/Cardlist/Cards.php new file mode 100644 index 0000000..70cfed0 --- /dev/null +++ b/dailymail/src/Trello/Api/Cardlist/Cards.php @@ -0,0 +1,100 @@ +get($this->getPath($id), $params); + } + + /** + * Filter cards related to a given list + * @link https://trello.com/docs/api/list/#get-1-lists-idlist-cards-filter + * + * @param string $id the list's id + * @param array $filter one of 'none', 'open', 'closed', 'all' + * + * @return array + */ + public function filter($id, $filter = 'all') + { + $allowed = array('none', 'open', 'closed', 'all'); + $filters = $this->validateAllowedParameters($allowed, $filter, 'filter'); + + return $this->get($this->getPath($id).'/'.implode(',', $filters)); + } + + /** + * Create a card + * @link https://trello.com/docs/api/list/#post-1-lists-idlist-cards + * + * @param array $params optional attributes + * + * @return array card info + */ + public function create($id, $name, array $params = array()) + { + $params['idList'] = $id; + $params['name'] = $name; + + if (!array_key_exists('due', $params)) { + $params['due'] = null; + } + + return $this->post($this->getPath($id), $params); + } + + /** + * Archive all cards of a given list + * @link https://trello.com/docs/api/list/#post-1-lists-idlist-archiveallcards + * + * @param string $id the list's id + * + * @return array + */ + public function archiveAll($id) + { + return $this->post('lists/'.rawurlencode($id).'/archiveAllCards'); + } + + /** + * Move all cards of a given list to another list + * @link https://trello.com/docs/api/list/#post-1-lists-idlist-moveallcards + * + * @param string $id Id of the list to move + * @param string $boardId id of the board that the cards should be moved to + * @param string $destListId id of the list that the cards should be moved to + * + * @return array + */ + public function moveAll($id, $boardId, $destListId) + { + $data = array( + 'idBoard' => $boardId, + 'idList' => $destListId, + ); + + return $this->post('lists/'.rawurlencode($id).'/moveAllCards', $data); + } +} diff --git a/dailymail/src/Trello/Api/Checklist.php b/dailymail/src/Trello/Api/Checklist.php new file mode 100644 index 0000000..f2b2fe4 --- /dev/null +++ b/dailymail/src/Trello/Api/Checklist.php @@ -0,0 +1,183 @@ +get($this->getPath().'/'.rawurlencode($id), $params); + } + + /** + * Create a checklist + * @link https://trello.com/docs/api/checklist/#post-1-checklists + * + * @param array $params optional attributes: 'name', 'idBoard', 'idCard', 'pos', 'idChecklistSource' + * + * @return array + */ + public function create(array $params = array()) + { + $this->validateRequiredParameters(array('name', 'idCard'), $params); + + return $this->post($this->getPath(), $params); + } + + /** + * Update a checklist + * @link https://trello.com/docs/api/checklist/#put-1-checklists-idchecklist + * + * @param string $id the list's id + * @param array $params list attributes to update + * + * @return array list info + */ + public function update($id, array $params = array()) + { + return $this->put($this->getPath().'/'.rawurlencode($id), $params); + } + + /** + * Remove a checklist + * @link https://trello.com/docs/api/checklist/#delete-1-checklists-idchecklist + * + * @param string $id the checklist's id + * + * @return array + */ + public function remove($id) + { + return $this->delete($this->getPath().'/'.rawurlencode($id)); + } + + /** + * Get the board of a given checklist + * @link https://trello.com/docs/api/checklist/#get-1-checklists-idchecklist-board + * + * @param string $id the checklist's id + * @param array $params optional parameters + * + * @return array board info + */ + public function getBoard($id, array $params = array()) + { + return $this->get($this->getPath().'/'.rawurlencode($id).'/board', $params); + } + + /** + * Get the field of a board of a given checklist + * @link https://trello.com/docs/api/checklist/#get-1-checklists-idchecklist-board-field + * + * @param string $id the checklist's id + * @param array $field the name of the field + * + * @return array board info + * + * @throws InvalidArgumentException if the field does not exist + */ + public function getBoardField($id, $field) + { + $this->validateAllowedParameters(Board::$fields, $field, 'field'); + + return $this->get($this->getPath().'/'.rawurlencode($id).'/board/'.rawurlencode($field)); + } + + /** + * Set a given checklist's card + * @link https://trello.com/docs/api/checklist/#put-1-checklists-idchecklist-idcard + * + * @param string $id the list's id + * @param string $cardId the card's id + * + * @return array + */ + public function setCard($id, $cardId) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/idCard', array('value' => $cardId)); + } + + /** + * Set a given checklist's name + * @link https://trello.com/docs/api/checklist/#put-1-checklists-idchecklist-name + * + * @param string $id the checklist's id + * @param string $name the name + * + * @return array + */ + public function setName($id, $name) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/name', array('value' => $name)); + } + + /** + * Set a given checklist's position + * @link https://trello.com/docs/api/checklist/#put-1-checklists-idchecklist-pos + * + * @param string $id the list's id + * @param string|integer $position the position, eg. 'top', 'bottom' + * or a positive number + * + * @return array list info + */ + public function setPosition($id, $position) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/pos', array('value' => $position)); + } + + /** + * Cards API + * + * @return Checklist\Cards + */ + public function cards() + { + return new Checklist\Cards($this->client); + } + + /** + * Items API + * + * @return Checklist\Items + */ + public function items() + { + return new Checklist\Items($this->client); + } +} diff --git a/dailymail/src/Trello/Api/Checklist/Cards.php b/dailymail/src/Trello/Api/Checklist/Cards.php new file mode 100644 index 0000000..8ccfb9f --- /dev/null +++ b/dailymail/src/Trello/Api/Checklist/Cards.php @@ -0,0 +1,47 @@ +get($this->getPath($id), $params); + } + + /** + * Filter cards related to a given checklist + * @link https://trello.com/docs/api/checklist/#get-1-checklists-idchecklist-cards-filter + * + * @param string $id the checklist's id + * @param array $filter one of 'none', 'open', 'closed', 'all' + * + * @return array + */ + public function filter($id, $filter = 'all') + { + $allowed = array('none', 'open', 'closed', 'all'); + $filters = $this->validateAllowedParameters($allowed, $filter, 'filter'); + + return $this->get($this->getPath($id).'/'.implode(',', $filters)); + } +} diff --git a/dailymail/src/Trello/Api/Checklist/Items.php b/dailymail/src/Trello/Api/Checklist/Items.php new file mode 100644 index 0000000..483b41f --- /dev/null +++ b/dailymail/src/Trello/Api/Checklist/Items.php @@ -0,0 +1,94 @@ +get($this->getPath($id), $params); + } + + /** + * Create an item in the given checklist + * @link https://trello.com/docs/api/checklist/#post-1-checklists-idchecklist-checkitems + * + * @param string $id Id of the checklist + * @param string $name Name of the item + * @param bool $checked Check status + * @param array $data optional attributes + * + * @return array + */ + public function create($id, $name, $checked = false, array $data = array()) + { + $data['checked'] = $checked; + $data['name'] = $name; + + return $this->post($this->getPath($id), $data); + } + + /** + * Update an item in the given checklist + * + * FIXME + * There is no put method on checklist items, so this is + * a dirty workaround which works by deleting the item + * and recreating it. + * + * @param string $id Id of the checklist + * @param string $itemId the id of the item to update + * @param array $data check item data + * + * @return array + */ + public function update($id, $itemId, array $data) + { + $this->validateRequiredParameters(array('name', 'state'), $data); + + $this->remove($id, $itemId); + + return $this->create($id, $data['name'], $data['state'], $data); + } + + /** + * Remove an item from checklist + * @link https://trello.com/docs/api/checklist/#delete-1-checklists-idchecklist-checkitems-idcheckitem + * + * @param string $id the id of the checklist the item should be removed from + * @param string $itemId the id of the item to delete + * + * @return array card info + */ + public function remove($id, $itemId) + { + return $this->delete($this->getPath($id).'/'.rawurlencode($itemId)); + } +} diff --git a/dailymail/src/Trello/Api/Member.php b/dailymail/src/Trello/Api/Member.php new file mode 100644 index 0000000..6a0dd16 --- /dev/null +++ b/dailymail/src/Trello/Api/Member.php @@ -0,0 +1,279 @@ +get($this->getPath().'/'.rawurlencode($id), $params); + } + + /** + * Update a member + * @link https://trello.com/docs/api/member/#put-1-members-idmember-or-username + * + * @param string $id the member's id or username + * @param array $params attributes to update: 'fullName', 'initials', 'username', 'bio', + * 'avatarSource', 'prefs/colorBlind', 'prefs/minutesBetweenSummaries' + * + * @return array list info + */ + public function update($id, array $params = array()) + { + return $this->put($this->getPath().'/'.rawurlencode($id), $params); + } + + /** + * Get a given member's deltas + * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-deltas + * + * @param string $id the member's id or username + * @param array $params optional parameters + * + * @return array + */ + public function getDeltas($id, array $params = array()) + { + return $this->get($this->path.'/'.rawurlencode($id).'/deltas', $params); + } + + /** + * Set a given member's avatarSource + * @link https://trello.com/docs/api/member/#put-1-members-idmember-or-username-avatarSource + * + * @param string $id the member's id or username + * @param string $avatarSource the avatarSource, one of 'none', 'upload', 'gravatar' + * + * @return array + */ + public function setAvatarSource($id, $avatarSource) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/avatarSource', array('value' => $avatarSource)); + } + + /** + * Set a given member's bio + * @link https://trello.com/docs/api/member/#put-1-members-idmember-or-username-bio + * + * @param string $id the member's id or username + * @param string $bio the bio + * + * @return array + */ + public function setBio($id, $bio) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/bio', array('value' => $bio)); + } + + /** + * Set a given member's full name + * @link https://trello.com/docs/api/member/#put-1-members-idmember-or-username-fullname + * + * @param string $id the member's id or username + * @param string $fullName the full name + * + * @return array + */ + public function setFullName($id, $fullName) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/fullName', array('value' => $fullName)); + } + + /** + * Set a given member's initials + * @link https://trello.com/docs/api/member/#put-1-members-idmember-or-username-initials + * + * @param string $id the member's id or username + * @param string $initials the initials + * + * @return array + */ + public function setInitials($id, $initials) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/initials', array('value' => $initials)); + } + + /** + * Set a given member's username + * @link https://trello.com/docs/api/member/#put-1-members-idmember-or-username-username + * + * @param string $id the member's id or username + * @param string $username the username + * + * @return array + */ + public function setUsername($id, $username) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/username', array('value' => $username)); + } + + /** + * Set a given member's avatar + * @link https://trello.com/docs/api/member/#put-1-members-idmember-or-avatar-avatar + * + * @param string $id the member's id or avatar + * + * @return array + */ + public function setAvatar($id, $file) + { + return $this->post($this->getPath().'/'.rawurlencode($id).'/avatar', array('file' => $file)); + } + + /** + * Actions API + * + * @return Member\Actions + */ + public function actions() + { + return new Member\Actions($this->client); + } + + /** + * Boards API + * + * @return Member\Boards + */ + public function boards() + { + return new Member\Boards($this->client); + } + + /** + * Cards API + * + * @return Member\Cards + */ + public function cards() + { + return new Member\Cards($this->client); + } + + /** + * Notifications API + * + * @return Member\Notifications + */ + public function notifications() + { + return new Member\Notifications($this->client); + } + + /** + * Organizations API + * + * @return Member\Organizations + */ + public function organizations() + { + return new Member\Organizations($this->client); + } + + /** + * Custom Backgrounds API + * + * @return Member\CustomBackgrounds + */ + public function customBackgrounds() + { + return new Member\CustomBackgrounds($this->client); + } + + /** + * Custom Emoji API + * + * @return Member\CustomEmoji + */ + public function customEmoji() + { + return new Member\CustomEmoji($this->client); + } + + /** + * Custom Stickers API + * + * @return Member\CustomStickers + */ + public function customStickers() + { + return new Member\CustomStickers($this->client); + } + + /** + * Saved Searches API + * + * @return Member\SavedSearches + */ + public function savedSearches() + { + return new Member\SavedSearches($this->client); + } +} diff --git a/dailymail/src/Trello/Api/Member/Actions.php b/dailymail/src/Trello/Api/Member/Actions.php new file mode 100644 index 0000000..3d1b140 --- /dev/null +++ b/dailymail/src/Trello/Api/Member/Actions.php @@ -0,0 +1,30 @@ +get($this->getPath($id), $params); + } +} diff --git a/dailymail/src/Trello/Api/Member/Board/Backgrounds.php b/dailymail/src/Trello/Api/Member/Board/Backgrounds.php new file mode 100644 index 0000000..d958777 --- /dev/null +++ b/dailymail/src/Trello/Api/Member/Board/Backgrounds.php @@ -0,0 +1,21 @@ +get($this->getPath($id), $params); + } + + /** + * Filter boards related to a given member + * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-boards-filter + * + * @param string $id the board's id + * @param string|array $filter array of / one of 'all', none', 'open', 'closed', 'all' + * + * @return array + */ + public function filter($id, $filter = 'all') + { + $allowed = array('all', 'members', 'organization', 'public', 'open', 'closed', 'pinned', 'unpinned', 'starred'); + $filters = $this->validateAllowedParameters($allowed, $filter, 'filter'); + + return $this->get($this->getPath($id).'/'.implode(',', $filters)); + } + + /** + * Get boads a given member is invited to + * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-boardsinvited + * + * @param string $id the member's id or username + * @param array $params optional parameters + * + * @return array + */ + public function invitedTo($id, array $params = array()) + { + return $this->get($this->getPath($id).'Invited', $params); + } + + /** + * Get a field of a boad a given member is invited to + * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-boardsinvited-field + * + * @param string $id the member's id or username + * + * @return array + */ + public function invitedToField($id, $field) + { + $this->validateAllowedParameters(Board::$fields, $field, 'field'); + + return $this->get($this->getPath($id).'Invited/'.rawurlencode($field)); + } + + /** + * Pin a boad for a given member + * @link https://trello.com/docs/api/member/#post-1-members-idmember-or-username-idboardspinned + * + * @param string $id the member's id or username + * @param string $boardId the board's id + * + * @return array + */ + public function pin($id, $boardId) + { + return $this->post('members/'.rawurlencode($id).'/idBoardsPinned', array('value' => $boardId)); + } + + /** + * Unpin a boad for a given member + * @link https://trello.com/docs/api/member/#delete-1-members-idmember-or-username-idboardspinned-idboard + * + * @param string $id the member's id or username + * @param string $boardId the board's id + * + * @return array + */ + public function unpin($id, $boardId) + { + return $this->delete('members/'.rawurlencode($id).'/idBoardsPinned/'.rawurlencode($boardId)); + } + + /** + * Board Backgrounds API + * + * @return Backgrounds + */ + public function backgrounds() + { + return new Backgrounds($this->client); + } + + /** + * Board Stars API + * + * @return Stars + */ + public function stars() + { + return new Stars($this->client); + } +} diff --git a/dailymail/src/Trello/Api/Member/Cards.php b/dailymail/src/Trello/Api/Member/Cards.php new file mode 100644 index 0000000..05c907f --- /dev/null +++ b/dailymail/src/Trello/Api/Member/Cards.php @@ -0,0 +1,47 @@ +get($this->getPath($id), $params); + } + + /** + * Filter cards related to a given list + * @link https://trello.com/docs/api/list/#get-1-lists-idlist-cards-filter + * + * @param string $id the list's id + * @param array $filter one of 'none', 'visible', 'open', 'closed', 'all' + * + * @return array + */ + public function filter($id, $filter = 'all') + { + $allowed = array('none', 'visible', 'open', 'closed', 'all'); + $filters = $this->validateAllowedParameters($allowed, $filter, 'filter'); + + return $this->get($this->getPath($id).'/'.implode(',', $filters)); + } +} diff --git a/dailymail/src/Trello/Api/Member/CustomBackgrounds.php b/dailymail/src/Trello/Api/Member/CustomBackgrounds.php new file mode 100644 index 0000000..d0373dc --- /dev/null +++ b/dailymail/src/Trello/Api/Member/CustomBackgrounds.php @@ -0,0 +1,21 @@ +get($this->getPath($id), $params); + } + + /** + * Filter notifications related to a given member + * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-notifications-filter + * + * @param string $id the member's id or username + * @param array $event one of the events defined in \Trello\Events or 'all' + * + * @return array + */ + public function filter($id, $event = 'all') + { + $events = Events::all(); + $events[] = 'all'; + + $events = $this->validateAllowedParameters($events, $event, 'event'); + + return $this->get($this->getPath($id).'/'.implode(',', $events)); + } +} diff --git a/dailymail/src/Trello/Api/Member/Organizations.php b/dailymail/src/Trello/Api/Member/Organizations.php new file mode 100644 index 0000000..7f90874 --- /dev/null +++ b/dailymail/src/Trello/Api/Member/Organizations.php @@ -0,0 +1,78 @@ +get($this->getPath($id), $params); + } + + /** + * Filter organizations related to a given member + * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-organizations-filter + * + * @param string $id the organization's id + * @param string|array $filter array of / one of 'all', 'none', 'members', 'public' + * + * @return array + */ + public function filter($id, $filter = 'all') + { + $allowed = array('all', 'none', 'members', 'public'); + $filters = $this->validateAllowedParameters($allowed, $filter, 'filter'); + + return $this->get($this->getPath($id).'/'.implode(',', $filters)); + } + + /** + * Get organizations a given member is invited to + * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-organizationsinvited + * + * @param string $id the member's id or username + * @param array $params optional parameters + * + * @return array + */ + public function invitedTo($id, array $params = array()) + { + return $this->get($this->getPath($id).'Invited', $params); + } + + /** + * Get a field of an organization a given member is invited to + * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-organizationsinvited-field + * + * @param string $id the member's id or username + * + * @return array + */ + public function invitedToField($id, $field) + { + $this->validateAllowedParameters(Organization::$fields, $field, 'field'); + + return $this->get($this->getPath($id).'Invited/'.rawurlencode($field)); + } +} diff --git a/dailymail/src/Trello/Api/Member/SavedSearches.php b/dailymail/src/Trello/Api/Member/SavedSearches.php new file mode 100644 index 0000000..dc884a2 --- /dev/null +++ b/dailymail/src/Trello/Api/Member/SavedSearches.php @@ -0,0 +1,24 @@ +get($this->getPath().'/'.rawurlencode($id), $params); + } + + /** + * Update a notification + * @link https://trello.com/docs/api/notification/#put-1-notifications-idnotification + * + * @param string $id the notification's id + * @param array $data attributes to update + * + * @return arrays + */ + public function update($id, array $data) + { + return $this->put($this->getPath().'/'.rawurlencode($id), $data); + } + + /** + * Set a notification's unread status + * @link https://trello.com/docs/api/notification/#put-1-notifications-idnotification-unread + * + * @param string $id the notification's id + * @param bool $status true for unread, false for read + * + * @return arrays + */ + public function setUnread($id, $status) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/unread', array('value' => $status)); + } + + /** + * Set all notification's as read + * @link https://trello.com/docs/api/notification/#put-1-notifications-idnotification-unread + * + * @return array + */ + public function setAllRead() + { + return $this->post($this->getPath().'/all/read'); + } + + /** + * Get a given notification's entities + * @link https://trello.com/docs/api/notification/#get-1-notifications-notification-id-entities + * + * @param string $id the notification's id + * @param array $params optional parameters + * + * @return array + */ + public function getEntities($id, array $params = array()) + { + return $this->get($this->path.'/'.rawurlencode($id).'/entities', $params); + } + + /** + * Get a notification's board + * @link https://trello.com/docs/api/notification/#get-1-notifications-idnotification-board + * + * @param string $id the notification's id + * @param array $params optional parameters + * + * @return array + */ + public function getBoard($id, array $params = array()) + { + return $this->get($this->getPath().'/'.rawurlencode($id).'/board', $params); + } + + /** + * Get the field of a board of a given card + * @link https://trello.com/docs/api/notification/#get-1-notifications-idnotification-board + * + * @param string $id the notification's id + * @param array $field the name of the field + * + * @return array + * + * @throws InvalidArgumentException if the field does not exist + */ + public function getBoardField($id, $field) + { + $this->validateAllowedParameters(Board::$fields, $field, 'field'); + + return $this->get($this->getPath().'/'.rawurlencode($id).'/board/'.rawurlencode($field)); + } + + /** + * Get a notification's list + * @link https://trello.com/docs/api/notification/#get-1-notifications-idnotification-list + * + * @param string $id the notification's id + * @param array $params optional parameters + * + * @return array + */ + public function getList($id, array $params = array()) + { + return $this->get($this->getPath().'/'.rawurlencode($id).'/list', $params); + } + + /** + * Get the field of a list of a given notification + * @link https://trello.com/docs/api/notification/index.html#get-1-notifications-idnotification-list-field + * + * @param string $id the notification's id + * @param array $field the name of the field + * + * @return array + * + * @throws InvalidArgumentException if the field does not exist + */ + public function getListField($id, $field) + { + $this->validateAllowedParameters(Cardlist::$fields, $field, 'field'); + + return $this->get($this->getPath().'/'.rawurlencode($id).'/list/'.rawurlencode($field)); + } + + /** + * Get a notification's card + * @link https://trello.com/docs/api/notification/#get-1-notifications-idnotification-card + * + * @param string $id the notification's id + * @param array $params optional parameters + * + * @return array + */ + public function getCard($id, array $params = array()) + { + return $this->get($this->getPath().'/'.rawurlencode($id).'/card', $params); + } + + /** + * Get the field of a card of a given notification + * @link https://trello.com/docs/api/notification/index.html#get-1-notifications-idnotification-card-field + * + * @param string $id the notification's id + * @param array $field the name of the field + * + * @return array + * + * @throws InvalidArgumentException if the field does not exist + */ + public function getCardField($id, $field) + { + $this->validateAllowedParameters(Card::$fields, $field, 'field'); + + return $this->get($this->getPath().'/'.rawurlencode($id).'/card/'.rawurlencode($field)); + } + + /** + * Get a notification's member + * @link https://trello.com/docs/api/notification/#get-1-notifications-idnotification-member + * + * @param string $id the notification's id + * @param array $params optional parameters + * + * @return array + */ + public function getMember($id, array $params = array()) + { + return $this->get($this->getPath().'/'.rawurlencode($id).'/member', $params); + } + + /** + * Get the field of a member of a given notification + * @link https://trello.com/docs/api/notification/#get-1-notifications-idnotification-member-field + * + * @param string $id the notification's id + * @param array $field the name of the field + * + * @return array + * + * @throws InvalidArgumentException if the field does not exist + */ + public function getMemberField($id, $field) + { + $this->validateAllowedParameters(Member::$fields, $field, 'field'); + + return $this->get($this->getPath().'/'.rawurlencode($id).'/member/'.rawurlencode($field)); + } + + /** + * Get a notification's creator + * @link https://trello.com/docs/api/notification/#get-1-notifications-idnotification-creator + * + * @param string $id the notification's id + * @param array $params optional parameters + * + * @return array + */ + public function getCreator($id, array $params = array()) + { + return $this->get($this->getPath().'/'.rawurlencode($id).'/memberCreator', $params); + } + + /** + * Get the field of a creator of a given notification + * @link https://trello.com/docs/api/notification/#get-1-notifications-idnotification-creator-field + * + * @param string $id the notification's id + * @param array $field the name of the field + * + * @return array + * + * @throws InvalidArgumentException if the field does not exist + */ + public function getCreatorField($id, $field) + { + $this->validateAllowedParameters(Member::$fields, $field, 'field'); + + return $this->get($this->getPath().'/'.rawurlencode($id).'/memberCreator/'.rawurlencode($field)); + } + + /** + * Get a notification's organization + * @link https://trello.com/docs/api/notification/#get-1-notifications-idnotification-organization + * + * @param string $id the notification's id + * @param array $params optional parameters + * + * @return array + */ + public function getOrganization($id, array $params = array()) + { + return $this->get($this->getPath().'/'.rawurlencode($id).'/organization', $params); + } + + /** + * Get the field of an organization of a given notification + * @link https://trello.com/docs/api/notification/#get-1-notifications-idnotification-organization-field + * + * @param string $id the notification's id + * @param array $field the name of the field + * + * @return array + * + * @throws InvalidArgumentException if the field does not exist + */ + public function getOrganizationField($id, $field) + { + $this->validateAllowedParameters(Organization::$fields, $field, 'field'); + + return $this->get($this->getPath().'/'.rawurlencode($id).'/organization/'.rawurlencode($field)); + } +} diff --git a/dailymail/src/Trello/Api/Organization.php b/dailymail/src/Trello/Api/Organization.php new file mode 100644 index 0000000..337598e --- /dev/null +++ b/dailymail/src/Trello/Api/Organization.php @@ -0,0 +1,56 @@ +get($this->getPath().'/'.rawurlencode($id), $params); + } +} diff --git a/dailymail/src/Trello/Api/Token.php b/dailymail/src/Trello/Api/Token.php new file mode 100644 index 0000000..5b2a4b2 --- /dev/null +++ b/dailymail/src/Trello/Api/Token.php @@ -0,0 +1,99 @@ +get($this->getPath().'/'.rawurlencode($id), $params); + } + + /** + * Remove a token + * @link https://trello.com/docs/api/token/#delete-1-tokens-idtoken + * + * @param string $id the token's id + * + * @return array + */ + public function remove($id) + { + return $this->delete($this->getPath().'/'.rawurlencode($id)); + } + + /** + * Get a given token's member + * @link https://trello.com/docs/api/token/#get-1-tokens-token-member + * + * @param string $id the token's id + * @param array $params optional parameters + * + * @return array + */ + public function getMember($id, array $params = array()) + { + return $this->get($this->getPath().'/'.rawurlencode($id).'/member', $params); + } + + /** + * Get a given token's member's field + * @link https://trello.com/docs/api/token/#get-1-tokens-token-member-field + * + * @param string $id the token's id + * + * @return array + */ + public function getMemberField($id, $field) + { + $this->validateAllowedParameters(Member::$fields, $field, 'field'); + + return $this->get($this->getPath().'/'.rawurlencode($id).'/member/'.rawurlencode($field)); + } + + /** + * Webhooks API + * + * @return Token\Webhooks + */ + public function webhooks() + { + return new Token\Webhooks($this->client); + } +} diff --git a/dailymail/src/Trello/Api/Token/Webhooks.php b/dailymail/src/Trello/Api/Token/Webhooks.php new file mode 100644 index 0000000..931acbf --- /dev/null +++ b/dailymail/src/Trello/Api/Token/Webhooks.php @@ -0,0 +1,90 @@ +get($this->getPath($id), $params); + } + + /** + * Get a webhook + * @link https://trello.com/docs/api/token/#get-1-tokens-token-webhooks-idwebhook + * + * @param string $id the token's id + * @param string $webhookId the webhook's id + * + * @return array + */ + public function show($id, $webhookId) + { + return $this->get($this->getPath($id).'/'.rawurlencode($webhookId)); + } + + /** + * Create a webhook + * @link https://trello.com/docs/api/token/#post-1-tokens-token-webhooks + * + * @param string $id the id of the token the webhook should be created on + * @param array $params optional attributes + * + * @return array card info + */ + public function create($id, array $params) + { + $this->validateRequiredParameters(array('callbackURL', 'idModel'), $params); + + return $this->post($this->getPath($id), $params); + } + + /** + * Update a webhook + * @link https://trello.com/docs/api/token/#put-1-tokens-token-webhooks + * + * @param string $id the id of the token the webhook is attached to + * @param array $params optional attributes + * + * @return array card info + */ + public function update($id, array $params) + { + $this->validateRequiredParameters(array('callbackURL', 'idModel'), $params); + + return $this->put($this->getPath($id), $params); + } + + /** + * Remove a webhook + * @link https://trello.com/docs/api/token/#delete-1-tokens-token-webhooks-idwebhook + * + * @param string $id the id of the token the webhook is attached to + * @param string $webhookId id of the webhook to remove + * + * @return array card info + */ + public function remove($id, $webhookId) + { + return $this->delete($this->getPath($id).'/'.rawurlencode($webhookId)); + } +} diff --git a/dailymail/src/Trello/Api/Webhook.php b/dailymail/src/Trello/Api/Webhook.php new file mode 100644 index 0000000..f81b843 --- /dev/null +++ b/dailymail/src/Trello/Api/Webhook.php @@ -0,0 +1,145 @@ +get($this->getPath().'/'.rawurlencode($id), $params); + } + + /** + * Create a webhook + * @link https://trello.com/docs/api/webhook/#post-1-webhooks + * + * @param array $params optional attributes + * + * @return array + */ + public function create(array $params = array()) + { + $this->validateRequiredParameters(array('callbackURL', 'idModel'), $params); + + return $this->post($this->getPath(), $params); + } + + /** + * Update a webhook + * @link https://trello.com/docs/api/webhook/#put-1-webhooks-idwebhook + * + * @param string $id the webhook's id + * @param array $params webhook attributes to update + * + * @return array + */ + public function update($id, array $params = array()) + { + $this->validateRequiredParameters(array('callbackURL', 'idModel'), $params); + + return $this->put($this->getPath().'/'.rawurlencode($id), $params); + } + + /** + * Remove a webhook + * @link https://trello.com/docs/api/webhook/#delete-1-webhooks-idwebhook + * + * @param string $id the webhook's id + * + * @return array + */ + public function remove($id) + { + return $this->delete($this->getPath().'/'.rawurlencode($id)); + } + + /** + * Set a given webhook's callback url + * @link https://trello.com/docs/api/webhook/#put-1-webhooks-idwebhook-callbackurl + * + * @param string $id the webhook's id + * @param string $url the webhook's callback url + * + * @return array + */ + public function setCallbackUrl($id, $url) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/callbackUrl', array('value' => $url)); + } + + /** + * Set a given webhook's description + * @link https://trello.com/docs/api/webhook/#put-1-webhooks-idwebhook-description + * + * @param string $id the webhook's id + * @param string $description the webhook's description + * + * @return array + */ + public function setDescription($id, $description) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/description', array('value' => $description)); + } + + /** + * Set a given webhook's board + * @link https://trello.com/docs/api/webhook/#put-1-webhooks-idwebhook-idmodel + * + * @param string $id the webhook's id + * @param string $modelId the webhook's model id + * + * @return array + */ + public function setModel($id, $modelId) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/idModel', array('value' => $modelId)); + } + + /** + * Set a given webhook's active state + * @link https://trello.com/docs/api/webhook/#put-1-webhooks-idwebhook-active + * + * @param string $id the webhook's id + * @param bool $active the webhook's status + * + * @return array + */ + public function setActive($id, $active) + { + return $this->put($this->getPath().'/'.rawurlencode($id).'/active', array('value' => $active)); + } +} diff --git a/dailymail/src/Trello/Client.php b/dailymail/src/Trello/Client.php new file mode 100644 index 0000000..0db754d --- /dev/null +++ b/dailymail/src/Trello/Client.php @@ -0,0 +1,284 @@ + 'https://api.trello.com/', + 'user_agent' => 'php-trello-api (http://github.com/cdaguerre/php-trello-api)', + 'timeout' => 10, + 'api_limit' => 5000, + 'api_version' => 1, + 'cache_dir' => null, + ); + + /** + * The Buzz instance used to communicate with Trello + * + * @var HttpClientInterface + */ + private $httpClient; + + /** + * Instantiate a new Trello client + * + * @param null|HttpClientInterface $httpClient Trello http client + */ + public function __construct(HttpClientInterface $httpClient = null) + { + $this->httpClient = $httpClient; + } + + /** + * Get an API by name + * + * @param string $name + * + * @return ApiInterface + * + * @throws InvalidArgumentException if the requested api does not exist + */ + public function api($name) + { + switch ($name) { + case 'action': + case 'actions': + $api = new Api\Action($this); + break; + case 'board': + case 'boards': + $api = new Api\Board($this); + break; + case 'card': + case 'cards': + $api = new Api\Card($this); + break; + case 'checklist': + case 'checklists': + $api = new Api\Checklist($this); + break; + case 'list': + case 'lists': + $api = new Api\Cardlist($this); + break; + case 'member': + case 'members': + $api = new Api\Member($this); + break; + case 'notification': + case 'notifications': + $api = new Api\Notification($this); + break; + case 'organization': + case 'organizations': + $api = new Api\Organization($this); + break; + case 'token': + case 'tokens': + $api = new Api\Token($this); + break; + case 'webhook': + case 'webhooks': + $api = new Api\Webhook($this); + break; + default: + throw new InvalidArgumentException(sprintf('Undefined api called: "%s"', $name)); + } + + return $api; + } + + /** + * Authenticate a user for all next requests + * + * @param string $tokenOrLogin Trello private token/username/client ID + * @param null|string $password Trello password/secret (optionally can contain $authMethod) + * @param null|string $authMethod One of the AUTH_* class constants + * + * @throws InvalidArgumentException If no authentication method was given + */ + public function authenticate($tokenOrLogin, $password = null, $authMethod = null) + { + if (null === $password && null === $authMethod) { + throw new InvalidArgumentException('You need to specify authentication method!'); + } + + if (null === $authMethod && in_array($password, array(self::AUTH_URL_TOKEN, self::AUTH_URL_CLIENT_ID, self::AUTH_HTTP_PASSWORD, self::AUTH_HTTP_TOKEN))) { + $authMethod = $password; + $password = null; + } + + if (null === $authMethod) { + $authMethod = self::AUTH_HTTP_PASSWORD; + } + + $this->getHttpClient()->authenticate($tokenOrLogin, $password, $authMethod); + } + + /** + * Get Http Client + * + * @return HttpClient + */ + public function getHttpClient() + { + if (null === $this->httpClient) { + $this->httpClient = new HttpClient($this->options); + } + + return $this->httpClient; + } + + /** + * Set Http Client + * + * @param HttpClientInterface $httpClient + */ + public function setHttpClient(HttpClientInterface $httpClient) + { + $this->httpClient = $httpClient; + } + + /** + * Clears used headers + */ + public function clearHeaders() + { + $this->getHttpClient()->clearHeaders(); + } + + /** + * Set headers + * + * @param array $headers + */ + public function setHeaders(array $headers) + { + $this->getHttpClient()->setHeaders($headers); + } + + /** + * Get option by name + * + * @param string $name the option's name + * + * @return mixed + * + * @throws InvalidArgumentException + */ + public function getOption($name) + { + if (!array_key_exists($name, $this->options)) { + throw new InvalidArgumentException(sprintf('Undefined option called: "%s"', $name)); + } + + return $this->options[$name]; + } + + /** + * Set option + * + * @param string $name + * @param mixed $value + * + * @throws InvalidArgumentException if the option is not defined + * @throws InvalidArgumentException if the api version is set to an unsupported one + */ + public function setOption($name, $value) + { + if (!array_key_exists($name, $this->options)) { + throw new InvalidArgumentException(sprintf('Undefined option called: "%s"', $name)); + } + + if ('api_version' == $name && !in_array($value, $this->getSupportedApiVersions())) { + throw new InvalidArgumentException(sprintf('Invalid API version ("%s"), valid are: %s', $name, implode(', ', $supportedApiVersions))); + } + + $this->options[$name] = $value; + } + + /** + * Returns an array of valid API versions supported by this client. + * + * @return integer[] + */ + public function getSupportedApiVersions() + { + return array(1); + } + + /** + * Proxies $this->members() to $this->api('members') + * + * @param string $name method name + * @param array $args arguments + * + * @return ApiInterface + * + * @throws BadMethodCallException + */ + public function __call($name, $args) + { + try { + return $this->api($name); + } catch (InvalidArgumentException $e) { + throw new BadMethodCallException(sprintf('Undefined method called: "%s"', $name)); + } + } +} diff --git a/dailymail/src/Trello/ClientInterface.php b/dailymail/src/Trello/ClientInterface.php new file mode 100644 index 0000000..91459f9 --- /dev/null +++ b/dailymail/src/Trello/ClientInterface.php @@ -0,0 +1,8 @@ +requestData = $requestData; + } + + /** + * Get request data + * + * @return array + */ + public function getRequestData() + { + return $this->requestData; + } +} diff --git a/dailymail/src/Trello/Event/BoardEvent.php b/dailymail/src/Trello/Event/BoardEvent.php new file mode 100644 index 0000000..49071a8 --- /dev/null +++ b/dailymail/src/Trello/Event/BoardEvent.php @@ -0,0 +1,33 @@ +board = $board; + } + + /** + * Get board + * + * @return BoardInterface + */ + public function getBoard() + { + return $this->board; + } +} diff --git a/dailymail/src/Trello/Event/BoardMemberEvent.php b/dailymail/src/Trello/Event/BoardMemberEvent.php new file mode 100644 index 0000000..ad5c781 --- /dev/null +++ b/dailymail/src/Trello/Event/BoardMemberEvent.php @@ -0,0 +1,33 @@ +member = $member; + } + + /** + * Get member + * + * @return MemberInterface + */ + public function getMember() + { + return $this->member; + } +} diff --git a/dailymail/src/Trello/Event/BoardOrganizationEvent.php b/dailymail/src/Trello/Event/BoardOrganizationEvent.php new file mode 100644 index 0000000..ab56008 --- /dev/null +++ b/dailymail/src/Trello/Event/BoardOrganizationEvent.php @@ -0,0 +1,33 @@ +organization = $organization; + } + + /** + * Get organization + * + * @return OrganizationInterface + */ + public function getOrganization() + { + return $this->organization; + } +} diff --git a/dailymail/src/Trello/Event/CardAttachmentEvent.php b/dailymail/src/Trello/Event/CardAttachmentEvent.php new file mode 100644 index 0000000..bdf4116 --- /dev/null +++ b/dailymail/src/Trello/Event/CardAttachmentEvent.php @@ -0,0 +1,31 @@ +attachment = $attachment; + } + + /** + * Get attachment + * + * @return array + */ + public function getAttachment() + { + return $this->attachment; + } +} diff --git a/dailymail/src/Trello/Event/CardChecklistEvent.php b/dailymail/src/Trello/Event/CardChecklistEvent.php new file mode 100644 index 0000000..33ff29c --- /dev/null +++ b/dailymail/src/Trello/Event/CardChecklistEvent.php @@ -0,0 +1,33 @@ +checklist = $checklist; + } + + /** + * Get checklist + * + * @return ChecklistInterface + */ + public function getChecklist() + { + return $this->checklist; + } +} diff --git a/dailymail/src/Trello/Event/CardCommentEvent.php b/dailymail/src/Trello/Event/CardCommentEvent.php new file mode 100644 index 0000000..ecbd192 --- /dev/null +++ b/dailymail/src/Trello/Event/CardCommentEvent.php @@ -0,0 +1,33 @@ +comment = $comment; + } + + /** + * Get comment + * + * @return CommentInterface + */ + public function getComment() + { + return $this->comment; + } +} diff --git a/dailymail/src/Trello/Event/CardCopyEvent.php b/dailymail/src/Trello/Event/CardCopyEvent.php new file mode 100644 index 0000000..4c9f91d --- /dev/null +++ b/dailymail/src/Trello/Event/CardCopyEvent.php @@ -0,0 +1,7 @@ +card = $card; + } + + /** + * Get card + * + * @return CardInterface + */ + public function getCard() + { + return $this->card; + } +} diff --git a/dailymail/src/Trello/Event/CardFromCheckItemEvent.php b/dailymail/src/Trello/Event/CardFromCheckItemEvent.php new file mode 100644 index 0000000..ef6d5cc --- /dev/null +++ b/dailymail/src/Trello/Event/CardFromCheckItemEvent.php @@ -0,0 +1,7 @@ +member = $member; + } + + /** + * Get member + * + * @return MemberInterface + */ + public function getMember() + { + return $this->member; + } +} diff --git a/dailymail/src/Trello/Event/CardMoveEvent.php b/dailymail/src/Trello/Event/CardMoveEvent.php new file mode 100644 index 0000000..89fc9fc --- /dev/null +++ b/dailymail/src/Trello/Event/CardMoveEvent.php @@ -0,0 +1,7 @@ +list = $list; + } + + /** + * Get cardlist + * + * @return CardlistInterface + */ + public function getList() + { + return $this->list; + } +} diff --git a/dailymail/src/Trello/Event/ListMoveEvent.php b/dailymail/src/Trello/Event/ListMoveEvent.php new file mode 100644 index 0000000..67d0c4b --- /dev/null +++ b/dailymail/src/Trello/Event/ListMoveEvent.php @@ -0,0 +1,7 @@ +member = $member; + } + + /** + * Get member + * + * @return MemberInterface + */ + public function getMember() + { + return $this->member; + } +} diff --git a/dailymail/src/Trello/Event/OrganizationEvent.php b/dailymail/src/Trello/Event/OrganizationEvent.php new file mode 100644 index 0000000..9365573 --- /dev/null +++ b/dailymail/src/Trello/Event/OrganizationEvent.php @@ -0,0 +1,33 @@ +organization = $organization; + } + + /** + * Get organization + * + * @return OrganizationInterface + */ + public function getOrganization() + { + return $this->organization; + } +} diff --git a/dailymail/src/Trello/Event/OrganizationMemberEvent.php b/dailymail/src/Trello/Event/OrganizationMemberEvent.php new file mode 100644 index 0000000..13084a9 --- /dev/null +++ b/dailymail/src/Trello/Event/OrganizationMemberEvent.php @@ -0,0 +1,33 @@ +member = $member; + } + + /** + * Get member + * + * @return MemberInterface + */ + public function getMember() + { + return $this->member; + } +} diff --git a/dailymail/src/Trello/Event/PowerUpEvent.php b/dailymail/src/Trello/Event/PowerUpEvent.php new file mode 100644 index 0000000..38ed8ce --- /dev/null +++ b/dailymail/src/Trello/Event/PowerUpEvent.php @@ -0,0 +1,33 @@ +powerUp = $powerUp; + } + + /** + * Get powerUp + * + * @return PowerUpInterface + */ + public function getPowerUp() + { + return $this->powerUp; + } +} diff --git a/dailymail/src/Trello/Events.php b/dailymail/src/Trello/Events.php new file mode 100644 index 0000000..7629a5f --- /dev/null +++ b/dailymail/src/Trello/Events.php @@ -0,0 +1,427 @@ + + */ +class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface +{ + +} diff --git a/dailymail/src/Trello/Exception/ErrorException.php b/dailymail/src/Trello/Exception/ErrorException.php new file mode 100644 index 0000000..69fc3dd --- /dev/null +++ b/dailymail/src/Trello/Exception/ErrorException.php @@ -0,0 +1,13 @@ + + */ +class ErrorException extends \ErrorException implements ExceptionInterface +{ + +} diff --git a/dailymail/src/Trello/Exception/ExceptionInterface.php b/dailymail/src/Trello/Exception/ExceptionInterface.php new file mode 100644 index 0000000..1278acd --- /dev/null +++ b/dailymail/src/Trello/Exception/ExceptionInterface.php @@ -0,0 +1,8 @@ + + */ +class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface +{ + +} diff --git a/dailymail/src/Trello/Exception/MissingArgumentException.php b/dailymail/src/Trello/Exception/MissingArgumentException.php new file mode 100644 index 0000000..f4f751a --- /dev/null +++ b/dailymail/src/Trello/Exception/MissingArgumentException.php @@ -0,0 +1,23 @@ + + */ +class MissingArgumentException extends ErrorException +{ + /** + * @param string $required + */ + public function __construct($required, $code = 0, $previous = null) + { + if (is_string($required)) { + $required = array($required); + } + + parent::__construct(sprintf('One or more of required ("%s") parameters are missing!', implode('", "', $required)), $code, $previous); + } +} diff --git a/dailymail/src/Trello/Exception/PermissionDeniedException.php b/dailymail/src/Trello/Exception/PermissionDeniedException.php new file mode 100644 index 0000000..a7d1527 --- /dev/null +++ b/dailymail/src/Trello/Exception/PermissionDeniedException.php @@ -0,0 +1,8 @@ + + */ +class RuntimeException extends \RuntimeException implements ExceptionInterface +{ + +} diff --git a/dailymail/src/Trello/Exception/ValidationFailedException.php b/dailymail/src/Trello/Exception/ValidationFailedException.php new file mode 100644 index 0000000..e496b37 --- /dev/null +++ b/dailymail/src/Trello/Exception/ValidationFailedException.php @@ -0,0 +1,13 @@ + + */ +class ValidationFailedException extends ErrorException +{ + +} diff --git a/dailymail/src/Trello/HttpClient/HttpClient.php b/dailymail/src/Trello/HttpClient/HttpClient.php new file mode 100644 index 0000000..0e8f84a --- /dev/null +++ b/dailymail/src/Trello/HttpClient/HttpClient.php @@ -0,0 +1,208 @@ + 'https://api.trello.com/', + 'user_agent' => 'php-trello-api (http://github.com/cdaguerre/php-trello-api)', + 'timeout' => 10, + 'api_version' => 1, + ); + + /** + * @var ClientInterface + */ + protected $client; + + protected $headers = array(); + + private $lastResponse; + private $lastRequest; + + /** + * @param array $options + * @param ClientInterface $client + */ + public function __construct(array $options = array(), ClientInterface $client = null) + { + $this->options = array_merge($this->options, $options); + $client = $client ?: new GuzzleClient($this->options['base_url'], $this->options); + $this->client = $client; + + $this->addListener('request.error', array(new ErrorListener($this->options), 'onRequestError')); + $this->clearHeaders(); + } + + /** + * {@inheritDoc} + */ + public function setOption($name, $value) + { + $this->options[$name] = $value; + } + + /** + * {@inheritDoc} + */ + public function setHeaders(array $headers) + { + $this->headers = array_merge($this->headers, $headers); + } + + /** + * Clears used headers + */ + public function clearHeaders() + { + $this->headers = array( + 'Accept' => sprintf('application/vnd.orcid.%s+json', $this->options['api_version']), + 'User-Agent' => sprintf('%s', $this->options['user_agent']), + ); + } + + /** + * @param string $eventName + */ + public function addListener($eventName, $listener) + { + $this->client->getEventDispatcher()->addListener($eventName, $listener); + } + + public function addSubscriber(EventSubscriberInterface $subscriber) + { + $this->client->addSubscriber($subscriber); + } + + /** + * {@inheritDoc} + */ + public function get($path, array $parameters = array(), array $headers = array()) + { + return $this->request($path, $parameters, 'GET', $headers); + } + + /** + * {@inheritDoc} + */ + public function post($path, $body = null, array $headers = array()) + { + if (!isset($headers['Content-Type'])) { + $headers['Content-Type'] = 'application/x-www-form-urlencoded'; + } + + return $this->request($path, $body, 'POST', $headers); + } + + /** + * {@inheritDoc} + */ + public function patch($path, $body = null, array $headers = array()) + { + if (!isset($headers['Content-Type'])) { + $headers['Content-Type'] = 'application/x-www-form-urlencoded'; + } + + return $this->request($path, $body, 'PATCH', $headers); + } + + /** + * {@inheritDoc} + */ + public function delete($path, $body = null, array $headers = array()) + { + return $this->request($path, $body, 'DELETE', $headers); + } + + /** + * {@inheritDoc} + */ + public function put($path, $body, array $headers = array()) + { + if (!isset($headers['Content-Type'])) { + $headers['Content-Type'] = 'application/x-www-form-urlencoded'; + } + + return $this->request($path, $body, 'PUT', $headers); + } + + /** + * {@inheritDoc} + */ + public function request($path, $body = null, $httpMethod = 'GET', array $headers = array(), array $options = array()) + { + $request = $this->createRequest($httpMethod, $path, $body, $headers, $options); + + try { + $response = $this->client->send($request); + } catch (\LogicException $e) { + throw new ErrorException($e->getMessage(), $e->getCode(), $e); + } catch (\RuntimeException $e) { + throw new RuntimeException($e->getMessage(), $e->getCode(), $e); + } + + $this->lastRequest = $request; + $this->lastResponse = $response; + + return $response; + } + + /** + * {@inheritDoc} + */ + public function authenticate($tokenOrLogin, $password = null, $method) + { + $this->addListener('request.before_send', array( + new AuthListener($tokenOrLogin, $password, $method), 'onRequestBeforeSend', + )); + } + + /** + * @return Request + */ + public function getLastRequest() + { + return $this->lastRequest; + } + + /** + * @return Response + */ + public function getLastResponse() + { + return $this->lastResponse; + } + + /** + * @param string $httpMethod + * @param string $path + */ + protected function createRequest($httpMethod, $path, $body = null, array $headers = array(), array $options = array()) + { + $path = $this->options['api_version'].'/'.$path; + + if ($httpMethod === 'GET' && $body) { + $path .= (false === strpos($path, '?') ? '?' : '&'); + $path .= utf8_encode(http_build_query($body, '', '&')); + } + + return $this->client->createRequest( + $httpMethod, + $path, + array_merge($this->headers, $headers), + $body, + $options + ); + } +} diff --git a/dailymail/src/Trello/HttpClient/HttpClientInterface.php b/dailymail/src/Trello/HttpClient/HttpClientInterface.php new file mode 100644 index 0000000..ae2cce3 --- /dev/null +++ b/dailymail/src/Trello/HttpClient/HttpClientInterface.php @@ -0,0 +1,109 @@ +tokenOrLogin = $tokenOrLogin; + $this->password = $password; + $this->method = $method; + } + + public function onRequestBeforeSend(Event $event) + { + // Skip by default + if (null === $this->method) { + return; + } + + switch ($this->method) { + case Client::AUTH_HTTP_PASSWORD: + $event['request']->setHeader( + 'Authorization', + sprintf('Basic %s', base64_encode($this->tokenOrLogin.':'.$this->password)) + ); + break; + + case Client::AUTH_HTTP_TOKEN: + $event['request']->setHeader( + 'Authorization', + sprintf('token %s', $this->tokenOrLogin) + ); + break; + + case Client::AUTH_URL_CLIENT_ID: + $url = $event['request']->getUrl(); + + $parameters = array( + 'key' => $this->tokenOrLogin, + 'token' => $this->password, + ); + + $url .= (false === strpos($url, '?') ? '?' : '&'); + $url .= utf8_encode(http_build_query($parameters, '', '&')); + + $event['request']->setUrl($url); + break; + + case Client::AUTH_URL_TOKEN: + $url = $event['request']->getUrl(); + $url .= (false === strpos($url, '?') ? '?' : '&'); + $url .= utf8_encode(http_build_query( + array('token' => $this->tokenOrLogin, 'key' => $this->password), + '', + '&' + )); + + $event['request']->setUrl($url); + break; + + default: + throw new RuntimeException(sprintf('%s not yet implemented', $this->method)); + } + } +} diff --git a/dailymail/src/Trello/HttpClient/Listener/ErrorListener.php b/dailymail/src/Trello/HttpClient/Listener/ErrorListener.php new file mode 100644 index 0000000..428d86e --- /dev/null +++ b/dailymail/src/Trello/HttpClient/Listener/ErrorListener.php @@ -0,0 +1,80 @@ +getResponse(); + + if (!$response->isClientError() && !$response->isServerError()) { + return; + } + + switch ($response->getStatusCode()) { + case 429: + throw new ApiLimitExceedException('Wait a second.', 429); + break; + } + + $content = ResponseMediator::getContent($response); + if (is_array($content) && isset($content['message'])) { + if (400 == $response->getStatusCode()) { + throw new ErrorException($content['message'], 400); + } + + if (401 == $response->getStatusCode()) { + throw new PermissionDeniedException($content['message'], 401); + } + + if (422 == $response->getStatusCode() && isset($content['errors'])) { + $errors = array(); + foreach ($content['errors'] as $error) { + switch ($error['code']) { + case 'missing': + $errors[] = sprintf('The %s %s does not exist, for resource "%s"', $error['field'], $error['value'], $error['resource']); + break; + + case 'missing_field': + $errors[] = sprintf('Field "%s" is missing, for resource "%s"', $error['field'], $error['resource']); + break; + + case 'invalid': + $errors[] = sprintf('Field "%s" is invalid, for resource "%s"', $error['field'], $error['resource']); + break; + + case 'already_exists': + $errors[] = sprintf('Field "%s" already exists, for resource "%s"', $error['field'], $error['resource']); + break; + + default: + $errors[] = $error['message']; + break; + + } + } + + throw new ValidationFailedException('Validation Failed: '.implode(', ', $errors), 422); + } + } + + throw new RuntimeException(isset($content['message']) ? $content['message'] : $content, $response->getStatusCode()); + } +} diff --git a/dailymail/src/Trello/HttpClient/Message/ResponseMediator.php b/dailymail/src/Trello/HttpClient/Message/ResponseMediator.php new file mode 100644 index 0000000..a2d9510 --- /dev/null +++ b/dailymail/src/Trello/HttpClient/Message/ResponseMediator.php @@ -0,0 +1,32 @@ +getBody(true); + + $content = json_decode($body, true); + + if (JSON_ERROR_NONE !== json_last_error()) { + return $body; + } + + return $content; + } + + /* + public static function getApiLimit(Response $response) + { + $remainingCalls = $response->getHeader('X-RateLimit-Remaining'); + + if (null !== $remainingCalls && 1 > $remainingCalls) { + throw new ApiLimitExceedException($remainingCalls); + } + } + */ +} diff --git a/dailymail/src/Trello/Manager.php b/dailymail/src/Trello/Manager.php new file mode 100644 index 0000000..c52295a --- /dev/null +++ b/dailymail/src/Trello/Manager.php @@ -0,0 +1,129 @@ +client = $client; + } + + /** + * Get organization by id or create a new one + * + * @param string $id the organization's id + * + * @return Model\OrganizationInterface + */ + public function getOrganization($id = null) + { + return new Model\Organization($this->client, $id); + } + + /** + * Get board by id or create a new one + * + * @param string $id the board's id + * + * @return Model\BoardInterface + */ + public function getBoard($id = null) + { + return new Model\Board($this->client, $id); + } + + /** + * Get cardlist by id or create a new one + * + * @param string $id the cardlist's id + * + * @return Model\CardlistInterface + */ + public function getList($id = null) + { + return new Model\Cardlist($this->client, $id); + } + + /** + * Get card by id or create a new one + * + * @param string $id the card's id + * + * @return Model\CardInterface + */ + public function getCard($id = null) + { + return new Model\Card($this->client, $id); + } + + /** + * Get checklist by id or create a new one + * + * @param string $id the checklist's id + * + * @return Model\ChecklistInterface + */ + public function getChecklist($id = null) + { + return new Model\Checklist($this->client, $id); + } + + /** + * Get member by id or create a new one + * + * @param string $id the member's id + * + * @return Model\MemberInterface + */ + public function getMember($id = null) + { + return new Model\Member($this->client, $id); + } + + /** + * Get action by id + * + * @param string $id the action's id + * + * @return Model\ActionInterface + */ + public function getAction($id) + { + return new Model\Action($this->client, $id); + } + + /** + * Get token by id + * + * @param string $id the token's id + * + * @return Model\TokenInterface + */ + public function getToken($id) + { + return new Model\Token($this->client, $id); + } + + /** + * Get webhook by id + * + * @param string $id the webhook's id + * + * @return Model\WebhookInterface + */ + public function getWebhook($id) + { + return new Model\Webhook($this->client, $id); + } +} diff --git a/dailymail/src/Trello/Model/AbstractObject.php b/dailymail/src/Trello/Model/AbstractObject.php new file mode 100644 index 0000000..09ab4e5 --- /dev/null +++ b/dailymail/src/Trello/Model/AbstractObject.php @@ -0,0 +1,246 @@ + 'all'); + + /** + * @var string + */ + protected $id; + + /** + * @var array + */ + protected $data; + + /** + * Constructor. + * + * @param ClientInterface $client the Trello client + * @param string $id the id of the object + */ + public function __construct(ClientInterface $client, $id = null) + { + $this->client = $client; + $this->api = $client->api($this->apiName); + + $this->fields = $this->api->getFields(); + + if ($id) { + $this->id = $id; + $this->refresh(); + } + } + + /** + * {@inheritdoc} + */ + public function getId() + { + return $this->id; + } + + /** + * {@inheritdoc} + */ + public function refresh() + { + $this->preRefresh(); + $this->data = $this->api->show($this->id, $this->loadParams); + $this->postRefresh(); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function save() + { + try { + $this->preSave(); + $this->id ? $this->update() : $this->create(); + $this->postSave(); + } catch (BadMethodCallException $e) { + throw new BadMethodCallException(sprintf( + "You can't %s %s objects.", + $this->id ? 'update' : 'create', + get_called_class() + )); + } + + return $this->refresh(); + } + + /** + * {@inheritdoc} + */ + public function remove() + { + try { + $this->preRemove(); + $this->api->remove($this->id); + $this->postRemove(); + } catch (BadMethodCallException $e) { + throw new BadMethodCallException(sprintf( + "You can't remove %s objects.", + get_called_class() + )); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getData() + { + return $this->data; + } + + /** + * {@inheritdoc} + */ + public function setData(array $data) + { + $this->data = $data; + + return $this; + } + + /** + * Update the object through API + * + * @return AbstractObject + */ + protected function update() + { + $this->preUpdate(); + $this->data = $this->api->update($this->id, $this->data); + $this->postUpdate(); + + return $this; + } + + /** + * Create the object through API + * + * @return AbstractObject + */ + protected function create() + { + $this->preCreate(); + $this->data = $this->api->create($this->data); + $this->id = $this->data['id']; + $this->postCreate(); + + return $this; + } + + /** + * Called before saving (creating or updating) an entity + */ + protected function preSave() + { + } + + /** + * Called after saving (creating or updating) an entity + */ + protected function postSave() + { + } + + /** + * Called before creating an entity + */ + protected function preCreate() + { + } + + /** + * Called after creating an entity + */ + protected function postCreate() + { + } + + /** + * Called before updating an entity + */ + protected function preUpdate() + { + } + + /** + * Called after updating an entity + */ + protected function postUpdate() + { + } + + /** + * Called before refreshing an entity + */ + protected function preRefresh() + { + } + + /** + * Called after refreshing an entity + */ + protected function postRefresh() + { + } + + /** + * Called before removing an entity + */ + protected function preRemove() + { + } + + /** + * Called after removing an entity + */ + protected function postRemove() + { + } +} diff --git a/dailymail/src/Trello/Model/Action.php b/dailymail/src/Trello/Model/Action.php new file mode 100644 index 0000000..9fade9b --- /dev/null +++ b/dailymail/src/Trello/Model/Action.php @@ -0,0 +1,11 @@ + 'all', + 'organization' => true, + 'organization_memberships' => 'all', + 'members' => 'all', + 'membersInvited' => 'all', + 'memberships' => 'all', + 'lists' => 'all', + ); + + /** + * {@inheritdoc} + */ + public function setName($name) + { + $this->data['name'] = $name; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return $this->data['name']; + } + + /** + * {@inheritdoc} + */ + public function setDescription($desc) + { + $this->data['desc'] = $desc; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getDescription() + { + return $this->data['desc']; + } + + /** + * {@inheritdoc} + */ + public function getDescriptionData() + { + return $this->data['descData']; + } + + /** + * {@inheritdoc} + */ + public function getUrl() + { + return $this->data['url']; + } + + /** + * {@inheritdoc} + */ + public function getShortUrl() + { + return $this->data['shortUrl']; + } + + /** + * {@inheritdoc} + */ + public function getShortLink() + { + return $this->data['shortLink']; + } + + /** + * {@inheritdoc} + */ + public function setOrganizationId($organizationId) + { + $this->data['idOrganization'] = $organizationId; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getOrganizationId() + { + return $this->data['idOrganization']; + } + + /** + * {@inheritdoc} + */ + public function setOrganization(OrganizationInterface $organization) + { + return $this->setOrganizationId($organization->getId()); + } + + /** + * {@inheritdoc} + */ + public function getOrganization() + { + return new Organization($this->client, $this->getOrganizationId()); + } + + /** + * {@inheritdoc} + */ + public function getLists() + { + $lists = array(); + + foreach ($this->data['lists'] as $data) { + $lists[$data['id']] = new Cardlist($this->client, $data['id']); + } + + return $lists; + } + + /** + * {@inheritdoc} + */ + public function getList($idOrName) + { + foreach ($this->getLists() as $list) { + if ($list->getName() === $idOrName || $list->getId() === $idOrName) { + return $list; + } + } + + throw new InvalidArgumentException(sprintf( + 'There is no list with name or id "%s" on this board ("%s")', + $idOrName, + $this->getName() + )); + } + + /** + * {@inheritdoc} + */ + public function setClosed($closed) + { + $this->data['closed'] = $closed; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function isClosed() + { + return $this->data['closed']; + } + + /** + * {@inheritdoc} + */ + public function setPinned($pinned) + { + $this->data['pinned'] = $pinned; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function isPinned() + { + return $this->data['pinned']; + } + + /** + * {@inheritdoc} + */ + public function setStarred($starred) + { + $this->data['starred'] = $starred; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function isStarred() + { + return $this->data['starred']; + } + + /** + * {@inheritdoc} + */ + public function setSubscribed($subscribed) + { + $this->data['subscribed'] = $subscribed; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function isSubscribed() + { + return $this->data['subscribed']; + } + + /** + * {@inheritdoc} + */ + public function isInvited() + { + return $this->data['invited']; + } + + /** + * {@inheritdoc} + */ + public function setRequiredRoleToInvite($role) + { + $this->data['invitations'] = $role; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getRequiredRoleToInvite() + { + return $this->data['invitations']; + } + + /** + * {@inheritdoc} + */ + public function setMemberships(array $memberships) + { + $this->data['memberships'] = $memberships; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getMemberships() + { + return $this->data['memberships']; + } + + /** + * {@inheritdoc} + */ + public function setPreferences(array $prefs) + { + $this->data['prefs'] = $prefs; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getPreferences() + { + return $this->data['prefs']; + } + + /** + * {@inheritdoc} + */ + public function setLabelNames(array $labelNames) + { + $this->data['labelNames'] = $labelNames; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getLabelNames() + { + return $this->data['labelNames']; + } + + /** + * {@inheritdoc} + */ + public function setPowerUps(array $powerUps) + { + $this->data['powerUps'] = $powerUps; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getPowerUps() + { + return $this->data['powerUps']; + } + + /** + * {@inheritdoc} + */ + public function getDateOfLastActivity() + { + return new \DateTime($this->data['dateLastActivity']); + } + + /** + * {@inheritdoc} + */ + public function getDateOfLastView() + { + return new \DateTime($this->data['dateLastView']); + } +} diff --git a/dailymail/src/Trello/Model/BoardInterface.php b/dailymail/src/Trello/Model/BoardInterface.php new file mode 100644 index 0000000..3fb05f9 --- /dev/null +++ b/dailymail/src/Trello/Model/BoardInterface.php @@ -0,0 +1,283 @@ + 'label name' + * existing colors are: 'green', 'yellow', 'orange', 'red', 'purple', 'blue' + * + * @return BoardInterface + */ + public function setLabelNames(array $labelNames); + + /** + * Get label names + * + * @return array + */ + public function getLabelNames(); + + /** + * Set power ups + * + * @param array $powerUps an array of 'voting', 'cardAging', 'calendar', 'recap' + * + * @return BoardInterface + */ + public function setPowerUps(array $powerUps); + + /** + * Get power ups + * + * @return array + */ + public function getPowerUps(); + + /** + * Get date last activity + * + * @return \DateTime + */ + public function getDateOfLastActivity(); + + /** + * Get date of last view + * + * @return \DateTime + */ + public function getDateOfLastView(); +} diff --git a/dailymail/src/Trello/Model/Card.php b/dailymail/src/Trello/Model/Card.php new file mode 100644 index 0000000..622d5d1 --- /dev/null +++ b/dailymail/src/Trello/Model/Card.php @@ -0,0 +1,835 @@ + 'all', + 'board' => true, + 'list' => true, + 'stickers' => true, + 'members' => true, + 'membersVoted' => true, + 'attachments' => true, + 'checklists' => 'all', + 'checkItemStates' => true, + 'actions' => Events::CARD_COMMENT, + ); + + protected $newChecklists = array(); + protected $newComments = array(); + protected $commentsToBeRemoved = array(); + + /** + * {@inheritdoc} + */ + public function getShortId() + { + return $this->data['idShort']; + } + + /** + * {@inheritdoc} + */ + public function setName($name) + { + $this->data['name'] = $name; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return $this->data['name']; + } + + /** + * {@inheritdoc} + */ + public function setDescription($desc) + { + $this->data['desc'] = $desc; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getDescription() + { + return $this->data['desc']; + } + + /** + * {@inheritdoc} + */ + public function getDescriptionData() + { + return $this->data['descData']; + } + + /** + * {@inheritdoc} + */ + public function getUrl() + { + return $this->data['url']; + } + + /** + * {@inheritdoc} + */ + public function getShortUrl() + { + return $this->data['shortUrl']; + } + + /** + * {@inheritdoc} + */ + public function getShortLink() + { + return $this->data['shortLink']; + } + + /** + * {@inheritdoc} + */ + public function setPosition($pos) + { + $this->data['pos'] = $pos; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getPosition() + { + return $this->data['pos']; + } + + /** + * {@inheritdoc} + */ + public function setDueDate(\DateTime $due = null) + { + $this->data['due'] = $due; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getDueDate() + { + if ($this->data['due'] instanceof \DateTime) { + return $this->data['due']; + } + + return new \DateTime($this->data['due']); + } + + /** + * {@inheritdoc} + */ + public function setEmail($email) + { + $this->data['email'] = $email; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getEmail() + { + return $this->data['email']; + } + + /** + * {@inheritdoc} + */ + public function setClosed($closed) + { + $this->data['closed'] = $closed; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function isClosed() + { + return $this->data['closed']; + } + + /** + * {@inheritdoc} + */ + public function setSubscribed($subscribed) + { + $this->data['subscribed'] = $subscribed; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function isSubscribed() + { + return $this->data['subscribed']; + } + + /** + * {@inheritdoc} + */ + public function setCheckItemStates(array $checkItemStates) + { + $this->data['checkItemStates'] = $checkItemStates; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getCheckItemStates() + { + return $this->data['checkItemStates']; + } + + /** + * {@inheritdoc} + */ + public function setBoardId($boardId) + { + $this->data['idBoard'] = $boardId; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getBoardId() + { + return $this->data['idBoard']; + } + + /** + * {@inheritdoc} + */ + public function setBoard(BoardInterface $board) + { + return $this->setBoardId($board->getId()); + } + + /** + * {@inheritdoc} + */ + public function getBoard() + { + return new Board($this->client, $this->getBoardId()); + } + + /** + * {@inheritdoc} + */ + public function setListId($listId) + { + $this->data['idList'] = $listId; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getListId() + { + return $this->data['idList']; + } + + /** + * {@inheritdoc} + */ + public function setList(CardlistInterface $list) + { + return $this->setListId($list->getId()); + } + + /** + * {@inheritdoc} + */ + public function getList() + { + return new Cardlist($this->client, $this->getListId()); + } + + public function moveToList($name) + { + foreach ($this->getBoard()->getLists() as $list) { + if ($list->getName() === $name) { + $this->setList($list); + + return $this; + } + } + + throw new InvalidArgumentException(sprintf( + 'Card "%s" could not be moved to list "%s" as no list with that name exists on the board named "%s"', + $this->getName(), + $name, + $this->getBoard()->getName() + )); + } + + /** + * {@inheritdoc} + */ + public function setChecklistIds(array $checklistIds) + { + $this->data['idChecklists'] = $checklistIds; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getChecklistIds() + { + return $this->data['idChecklists']; + } + + /** + * {@inheritdoc} + */ + public function setChecklists(array $checklists) + { + $ids = array(); + + foreach ($checklists as $checklist) { + $ids[] = $checklist->getId(); + } + + return $this->setChecklistIds($ids); + } + + /** + * {@inheritdoc} + */ + public function getChecklists() + { + $checklists = array(); + + foreach ($this->getChecklistIds() as $id) { + $checklists[] = new Checklist($this->client, $id); + } + + $checklists = array_merge($checklists, $this->newChecklists); + + return $checklists; + } + + /** + * {@inheritdoc} + * @param string $name + */ + public function getChecklist($name) + { + foreach ($this->getChecklists() as $checklist) { + if ($checklist->getName() === $name) { + return $checklist; + } + } + + throw new InvalidArgumentException(sprintf( + 'There is no checklist named "%s" on this card (%s).', + $name, + $this->getName() + )); + } + + /** + * {@inheritdoc} + */ + public function hasChecklist($checklist) + { + if ($checklist instanceof ChecklistInterface) { + return in_array($checklist->getId(), $this->data['idChecklists']); + } + + foreach ($this->getChecklists() as $existingList) { + if ($existingList->getName() === $checklist) { + return true; + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function addChecklist($checklist) + { + if (!$this->id) { + throw new RuntimeException("You can't add checklists to a new card, you have to save it first."); + } + + if (!$checklist instanceof ChecklistInterface) { + $name = $checklist; + $checklist = new Checklist($this->client); + $checklist->setName($name); + } + + $checklist->setCard($this); + + if (!$checklist->getId()) { + $this->newChecklists[] = $checklist; + + return $this; + } + + if ($this->hasChecklist($checklist)) { + throw new InvalidArgumentException(sprintf( + 'Checklist %s is already on this card (%s).', + $checklist->getName(), + $this->getName() + )); + } + + $this->data['idChecklists'][] = $checklist->getId(); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function removeChecklist($checklist) + { + if (!$this->hasChecklist($checklist)) { + throw new InvalidArgumentException(sprintf( + "Checklist %s is not on this card (%s), so you can't remove it.", + is_object($checklist) ? $checklist->getName() : $checklist, + $this->getName() + )); + } + + if (!$checklist instanceof ChecklistInterface) { + $checklist = $this->getChecklist($checklist); + } + + foreach ($this->data['idChecklists'] as $key => $checklistId) { + if ($checklistId === $checklist->getId()) { + unset($this->data['idChecklists'][$key]); + $checklist->remove(); + } + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setMemberIds(array $memberIds) + { + $this->data['idMembers'] = $memberIds; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getMemberIds() + { + return $this->data['idMembers']; + } + + /** + * {@inheritdoc} + */ + public function hasMember(MemberInterface $member) + { + return in_array($member->getId(), $this->data['idMembers']); + } + + /** + * {@inheritdoc} + */ + public function addMember(MemberInterface $member) + { + if ($this->hasMember($member)) { + throw new InvalidArgumentException(sprintf( + 'Member %s is already on this card (%s).', + $member->getFullName(), + $this->getName() + )); + } + + $this->data['idMembers'][] = $member->getId(); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function removeMember(MemberInterface $member) + { + if (!$this->hasMember($member)) { + throw new InvalidArgumentException(sprintf( + "Member %s is not on this card (%s), so you can't remove him.", + $member->getFullName(), + $this->getName() + )); + } + + foreach ($this->data['idMembers'] as $key => $memberArray) { + if ($memberArray['id'] === $member->getId()) { + unset($this->data['idMembers'][$key]); + } + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setMembers(array $members) + { + $ids = array(); + + foreach ($members as $member) { + $ids[] = $member->getId(); + } + + return $this->setMemberIds($ids); + } + + /** + * {@inheritdoc} + */ + public function getMembers() + { + $members = array(); + + foreach ($this->getMemberIds() as $id) { + $members[] = new Member($this->client, $id); + } + + return $members; + } + + /** + * {@inheritdoc} + */ + public function setMembersVotedIds(array $membersVotedIds) + { + $this->data['idMembersVoted'] = $membersVotedIds; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getMembersVotedIds() + { + return $this->data['idMembersVoted']; + } + + /** + * {@inheritdoc} + */ + public function hasMemberVoted(MemberInterface $member) + { + return in_array($member->getId(), $this->data['idMembersVoted']); + } + + /** + * {@inheritdoc} + */ + public function addMemberVoted(MemberInterface $member) + { + if ($this->hasMemberVoted($member)) { + throw new InvalidArgumentException(sprintf( + 'Member %s has already voted this card (%s).', + $member->getFullName(), + $this->getName() + )); + } + + $this->data['idMembersVoted'][] = $member->getId(); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function removeMemberVoted(MemberInterface $member) + { + if (!$this->hasMemberVoted($member)) { + throw new InvalidArgumentException(sprintf( + "Member %s hasn't voted this card (%s), so you can't remove his vote.", + $member->getFullName(), + $this->getName() + )); + } + + foreach ($this->data['idMembersVoted'] as $key => $memberArray) { + if ($memberArray['id'] === $member->getId()) { + unset($this->data['idMembersVoted'][$key]); + } + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setMembersVoted(array $members) + { + $ids = array(); + + foreach ($members as $member) { + $ids[] = $member->getId(); + } + + return $this->setMembersVotedIds($ids); + } + + /** + * {@inheritdoc} + */ + public function getMembersVoted() + { + $members = array(); + + foreach ($this->getMembersVotedIds() as $id) { + $members[] = new Member($this->client, $id); + } + + return $members; + } + + /** + * {@inheritdoc} + */ + public function setAttachmentCoverId($attachmentCoverId) + { + $this->data['idAttachmentCover'] = $attachmentCoverId; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getAttachmentCoverId() + { + return $this->data['idAttachmentCover']; + } + + /** + * {@inheritdoc} + */ + public function setManualCoverAttachment($coverAttachment) + { + $this->data['manualCoverAttachment'] = $coverAttachment; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getManualCoverAttachment() + { + return $this->data['manualCoverAttachment']; + } + + /** + * {@inheritdoc} + */ + public function setLabels(array $labels) + { + $this->data['labels'] = $labels; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getLabels() + { + return $this->data['labels']; + } + + /** + * {@inheritdoc} + */ + public function getLabelColors() + { + return array_map(function ($label) { + return $label['color']; + }, $this->data['labels']); + } + + /** + * {@inheritdoc} + */ + public function hasLabel($color) + { + return in_array($color, $this->getLabelColors()); + } + + /** + * {@inheritdoc} + */ + public function addLabel($color) + { + if ($this->hasLabel($color)) { + throw new InvalidArgumentException(sprintf( + 'Card %s already has the %s label.', + $this->getName(), + $color + )); + } + + $this->data['labels'][] = array('color' => $color); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function removeLabel($color) + { + if (!$this->hasLabel($color)) { + throw new InvalidArgumentException(sprintf( + "Can't remove the %s label because card %s doesn't have it.", + $color, + $this->getName() + )); + } + + foreach ($this->data['labels'] as $key => $label) { + if ($label['color'] === $color) { + unset($this->data['labels'][$key]); + } + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setBadges(array $badges) + { + $this->data['badges'] = $badges; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getBadges() + { + return $this->data['badges']; + } + + /** + * {@inheritdoc} + */ + public function getDateOfLastActivity() + { + return new \DateTime($this->data['dateLastActivity']); + } + + /** + * {@inheritdoc} + */ + public function getActions($params = array()) + { + return $this->api->actions()->all($this->id, $params); + } + + /** + * {@inheritdoc} + */ + public function addComment($text) + { + $this->newComments[] = $text; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function removeComment($commentId) + { + $this->commentsToBeRemoved[] = $commentId; + + return $this; + } + + /** + * {@inheritdoc} + */ + protected function preSave() + { + foreach ($this->newChecklists as $checklist) { + $checklist->save(); + $this->addChecklist($checklist); + } + } + + /** + * {@inheritdoc} + */ + protected function postSave() + { + foreach ($this->newComments as $key => $text) { + $this->api->actions()->addComment($this->id, $text); + unset($this->newComments[$key]); + } + + foreach ($this->commentsToBeRemoved as $key => $commentId) { + $this->api->actions()->removeComment($this->id, $commentId); + unset($this->commentsToBeRemoved[$key]); + } + } +} diff --git a/dailymail/src/Trello/Model/CardInterface.php b/dailymail/src/Trello/Model/CardInterface.php new file mode 100644 index 0000000..78e433b --- /dev/null +++ b/dailymail/src/Trello/Model/CardInterface.php @@ -0,0 +1,561 @@ + 'all', + 'fields' => 'all', + ); + + /** + * {@inheritdoc} + */ + public function setName($name) + { + $this->data['name'] = $name; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return $this->data['name']; + } + + /** + * {@inheritdoc} + */ + public function setBoardId($boardId) + { + $this->data['idBoard'] = $boardId; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getBoardId() + { + return $this->data['idBoard']; + } + + /** + * {@inheritdoc} + */ + public function setBoard(BoardInterface $board) + { + return $this->setBoardId($board->getId()); + } + + /** + * {@inheritdoc} + */ + public function getBoard() + { + return new Board($this->client, $this->getBoardId()); + } + + /** + * {@inheritdoc} + */ + public function setPosition($pos) + { + $this->data['pos'] = $pos; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getPosition() + { + return $this->data['pos']; + } + + /** + * {@inheritdoc} + */ + public function setClosed($closed) + { + $this->data['closed'] = $closed; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function isClosed() + { + return $this->data['closed']; + } + + /** + * {@inheritdoc} + */ + public function setSubscribed($subscribed) + { + $this->data['subscribed'] = $subscribed; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function isSubscribed() + { + return $this->data['subscribed']; + } + + /** + * {@inheritdoc} + */ + public function getCards() + { + $cards = array(); + + foreach ($this->data['cards'] as $card) { + $cards[] = new Card($this->client, $card['id']); + } + + return $cards; + } +} diff --git a/dailymail/src/Trello/Model/CardlistInterface.php b/dailymail/src/Trello/Model/CardlistInterface.php new file mode 100644 index 0000000..00db9bd --- /dev/null +++ b/dailymail/src/Trello/Model/CardlistInterface.php @@ -0,0 +1,109 @@ + 'all', + 'checkItems' => 'all', + 'checkItem_fields' => 'all', + ); + + protected $itemsToBeRemoved = array(); + + public function __construct(ClientInterface $client, $id = null) + { + $this->data = array( + 'name' => null, + 'checkItems' => array(), + ); + + parent::__construct($client, $id); + } + + /** + * {@inheritdoc} + */ + public function setName($name) + { + $this->data['name'] = $name; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return $this->data['name']; + } + + /** + * {@inheritdoc} + */ + public function setBoardId($boardId) + { + $this->data['idBoard'] = $boardId; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getBoardId() + { + return $this->data['idBoard']; + } + + /** + * {@inheritdoc} + */ + public function setBoard(BoardInterface $board) + { + return $this->setBoardId($board->getId()); + } + + /** + * {@inheritdoc} + */ + public function getBoard() + { + return new Board($this->client, $this->getBoardId()); + } + + /** + * {@inheritdoc} + */ + public function setCardId($cardId) + { + $this->data['idCard'] = $cardId; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getCardId() + { + return $this->data['idCard']; + } + + /** + * {@inheritdoc} + */ + public function setCard(CardInterface $card) + { + return $this->setCardId($card->getId()); + } + + /** + * {@inheritdoc} + */ + public function getCard() + { + return new Card($this->client, $this->getCardId()); + } + + /** + * {@inheritdoc} + */ + public function setPosition($pos) + { + $this->data['pos'] = $pos; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getPosition() + { + return $this->data['pos']; + } + + /** + * {@inheritdoc} + */ + public function getItems() + { + return $this->data['checkItems']; + } + + /** + * {@inheritdoc} + * @param string $nameOrId + */ + public function hasItem($nameOrId) + { + foreach ($this->getItems() as $item) { + if ($item['name'] === $nameOrId || (isset($item['id']) && $item['id'] === $nameOrId)) { + return true; + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function getItemKey($nameOrId) + { + foreach ($this->getItems() as $key => $item) { + if ($item['name'] === $nameOrId || (isset($item['id']) && $item['id'] === $nameOrId)) { + return $key; + } + } + + throw new InvalidArgumentException(sprintf( + 'Checklist "%s" does not have an item with name or id "%s"', + $this->getName(), + $nameOrId + )); + } + + /** + * {@inheritdoc} + */ + public function removeItem($nameOrId) + { + $key = $this->getItemKey($nameOrId); + + if (isset($this->data['checkItems'][$key]['id'])) { + $this->itemsToBeRemoved[] = $this->data['checkItems'][$key]['id']; + } + + unset($this->data['checkItems'][$key]); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setItem($nameOrId, $checked = null, $position = null) + { + if ($this->hasItem($nameOrId)) { + $key = $this->getItemKey($nameOrId); + + $this->data['checkItems'][$key]['state'] = $checked; + + if (isset($position)) { + $this->data['checkItems'][$key]['position'] = $position; + } + } else { + $this->data['checkItems'][] = array( + 'name' => $nameOrId, + 'state' => $checked, + 'position' => $position, + ); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setItemChecked($nameOrId, $bool) + { + $key = $this->getItemKey($nameOrId); + $this->data['checkItems'][$key]['state'] = $bool; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function isItemChecked($nameOrId) + { + $key = $this->getItemKey($nameOrId); + + return $this->data['checkItems'][$key]['state']; + } + + /** + * {@inheritdoc} + */ + protected function postRefresh() + { + foreach ($this->data['checkItems'] as $key => $item) { + $this->data['checkItems'][$key]['state'] = in_array($item['state'], array(true, 'complete', 'true')); + } + } + + /** + * {@inheritdoc} + */ + protected function preSave() + { + $items = $this->data['checkItems']; + + if (!$this->id) { + $this->create(); + } + + foreach ($this->itemsToBeRemoved as $itemId) { + $this->api->items()->remove($this->id, $itemId); + } + foreach ($items as $item) { + if (isset($item['id'])) { + $this->api->items()->update($this->id, $item['id'], $item); + } else { + $this->api->items()->create($this->id, $item['name'], $item['state'], $item); + } + } + } +} diff --git a/dailymail/src/Trello/Model/ChecklistInterface.php b/dailymail/src/Trello/Model/ChecklistInterface.php new file mode 100644 index 0000000..ce5ed96 --- /dev/null +++ b/dailymail/src/Trello/Model/ChecklistInterface.php @@ -0,0 +1,133 @@ + 'all', + ); + + /** + * {@inheritdoc} + */ + public function setAvatarHash($avatarHash) + { + $this->data['avatarHash'] = $avatarHash; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getAvatarHash() + { + return $this->data['avatarHash']; + } + + /** + * {@inheritdoc} + */ + public function setBio($bio) + { + $this->data['bio'] = $bio; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getBio() + { + return $this->data['bio']; + } + + /** + * {@inheritdoc} + */ + public function getBioData() + { + return $this->data['bioData']; + } + + /** + * {@inheritdoc} + */ + public function setConfirmed($confirmed) + { + $this->data['confirmed'] = $confirmed; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function isConfirmed() + { + return $this->data['confirmed']; + } + + /** + * {@inheritdoc} + */ + public function setFullName($fullName) + { + $this->data['fullName'] = $fullName; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getFullName() + { + return $this->data['fullName']; + } + + /** + * {@inheritdoc} + */ + public function setIdPremOrgsAdmin(array $idPremOrgsAdmin) + { + $this->data['idPremOrgsAdmin'] = $idPremOrgsAdmin; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getIdPremOrgsAdmin() + { + return $this->data['idPremOrgsAdmin']; + } + + /** + * {@inheritdoc} + */ + public function setInitials($initials) + { + $this->data['initials'] = $initials; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getInitials() + { + return $this->data['initials']; + } + + /** + * {@inheritdoc} + */ + public function setMemberType($memberType) + { + if (!in_array($memberType, array('admin', 'normal', 'observer'))) { + throw new InvalidArgumentException(sprintf( + 'The member type %s does not exist.', + $memberType + )); + } + + $this->data['memberType'] = $memberType; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getMemberType() + { + return $this->data['memberType']; + } + + /** + * {@inheritdoc} + */ + public function setProducts(array $products) + { + $this->data['products'] = $products; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getProducts() + { + return $this->data['products']; + } + + /** + * {@inheritdoc} + */ + public function setStatus($status) + { + $this->data['status'] = $status; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getStatus() + { + return $this->data['status']; + } + + /** + * {@inheritdoc} + */ + public function setUrl($url) + { + $this->data['url'] = $url; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getUrl() + { + return $this->data['url']; + } + + /** + * {@inheritdoc} + */ + public function setUsername($username) + { + $this->data['username'] = $username; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getUsername() + { + return $this->data['username']; + } + + /** + * {@inheritdoc} + */ + public function setAvatarSource($avatarSource) + { + $this->data['avatarSource'] = $avatarSource; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getAvatarSource() + { + return $this->data['avatarSource']; + } + + /** + * {@inheritdoc} + */ + public function setEmail($email) + { + $this->data['email'] = $email; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getEmail() + { + return $this->data['email']; + } + + /** + * {@inheritdoc} + */ + public function setGravatarHash($gravatarHash) + { + $this->data['gravatarHash'] = $gravatarHash; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getGravatarHash() + { + return $this->data['gravatarHash']; + } + + /** + * {@inheritdoc} + */ + public function setBoardIds(array $boardIds) + { + $this->data['idBoards'] = $boardIds; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getBoardIds() + { + return $this->data['idBoards']; + } + + /** + * {@inheritdoc} + */ + public function getBoards() + { + $boards = array(); + + foreach ($this->data['idBoards'] as $boardId) { + $boards[] = new Board($this->client, $boardId); + } + + return $boards; + } + + /** + * {@inheritdoc} + */ + public function setPinnedBoardIds(array $pinnedBoardIds) + { + $this->data['idBoardsPinned'] = $pinnedBoardIds; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getPinnedBoardIds() + { + return $this->data['idBoardsPinned']; + } + + /** + * {@inheritdoc} + */ + public function getPinnedBoards() + { + $boards = array(); + + foreach ($this->data['idBoardsPinned'] as $boardId) { + $boards[] = new Board($this->client, $boardId); + } + + return $boards; + } + + /** + * {@inheritdoc} + */ + public function setOrganizationIds(array $organizationIds) + { + $this->data['idOrganizations'] = $organizationIds; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getOrganizationIds() + { + return $this->data['idOrganizations']; + } + + /** + * {@inheritdoc} + */ + public function getOrganizations() + { + $organizations = array(); + + foreach ($this->data['idOrganizations'] as $organizationId) { + $organizations[] = new Organization($this->client, $organizationId); + } + + return $organizations; + } + + /** + * {@inheritdoc} + */ + public function setLoginTypes($loginTypes) + { + $this->data['loginTypes'] = $loginTypes; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getLoginTypes() + { + return $this->data['loginTypes']; + } + + /** + * {@inheritdoc} + */ + public function setNewEmail($newEmail) + { + $this->data['newEmail'] = $newEmail; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setOneTimeMessagesDismissed(array $messages) + { + $this->data['oneTimeMessagesDismissed'] = $messages; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getOneTimeMessagesDismissed() + { + return $this->data['oneTimeMessagesDismissed']; + } + + /** + * {@inheritdoc} + */ + public function setPreferences(array $prefs) + { + $this->data['prefs'] = $prefs; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getPreferences() + { + return $this->data['prefs']; + } + + /** + * {@inheritdoc} + */ + public function setTrophies(array $trophies) + { + $this->data['trophies'] = $trophies; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getTrophies() + { + return $this->data['trophies']; + } + + /** + * {@inheritdoc} + */ + public function setUploadedAvatarHash($uploadedAvatarHash) + { + $this->data['uploadedAvatarHash'] = $uploadedAvatarHash; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getUploadedAvatarHash() + { + return $this->data['uploadedAvatarHash']; + } + + /** + * {@inheritdoc} + */ + public function setPremiumFeatures(array $premiumFeatures) + { + $this->data['premiumFeatures'] = $premiumFeatures; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getPremiumFeatures() + { + return $this->data['premiumFeatures']; + } +} diff --git a/dailymail/src/Trello/Model/MemberInterface.php b/dailymail/src/Trello/Model/MemberInterface.php new file mode 100644 index 0000000..60b343c --- /dev/null +++ b/dailymail/src/Trello/Model/MemberInterface.php @@ -0,0 +1,411 @@ + 'all', + 'members' => 'all', + 'membersInvited' => 'all', + ); + + /** + * {@inheritdoc} + */ + public function setName($name) + { + $this->data['name'] = $name; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return $this->data['name']; + } + + /** + * {@inheritdoc} + */ + public function setDisplayName($displayName) + { + $this->data['displayName'] = $displayName; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getDisplayName() + { + return $this->data['displayName']; + } + + /** + * {@inheritdoc} + */ + public function setDescription($desc) + { + $this->data['desc'] = $desc; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getDesciption() + { + return $this->data['desc']; + } + + /** + * {@inheritdoc} + */ + public function setDescriptionData($descData) + { + $this->data['descData'] = $descData; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getDescriptionData() + { + return $this->data['descData']; + } + + /** + * {@inheritdoc} + */ + public function setBoardIds(array $boardIds) + { + $this->data['idBoards'] = $boardIds; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getBoardIds() + { + return $this->data['idBoards']; + } + + /** + * {@inheritdoc} + */ + public function getBoards() + { + $boards = array(); + + foreach ($this->data['idBoards'] as $boardId) { + $boards[] = new Board($this->client, $boardId); + } + + return $boards; + } + + /** + * {@inheritdoc} + */ + public function setInvited(array $invited) + { + $this->data['invited'] = $invited; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getInvited() + { + return $this->data['invited']; + } + + /** + * {@inheritdoc} + */ + public function setInvitations(array $invitations) + { + $this->data['invitations'] = $invitations; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getInvitations() + { + return $this->data['invitations']; + } + + /** + * {@inheritdoc} + */ + public function getMemberships() + { + return $this->data['memberships']; + } + + /** + * {@inheritdoc} + */ + public function setPreferences(array $prefs) + { + $this->data['prefs'] = $prefs; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getPreferences() + { + return $this->data['prefs']; + } + + /** + * {@inheritdoc} + */ + public function setPowerUps(array $powerUps) + { + $this->data['powerUps'] = $powerUps; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getPowerUps() + { + return $this->data['powerUps']; + } + + /** + * {@inheritdoc} + */ + public function setProducts(array $products) + { + $this->data['products'] = $products; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getProducts() + { + return $this->data['products']; + } + + /** + * {@inheritdoc} + */ + public function getBillableMemberCount() + { + return $this->data['billableMemberCount']; + } + + /** + * {@inheritdoc} + */ + public function setUrl($url) + { + $this->data['url'] = $url; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getUrl() + { + return $this->data['url']; + } + + /** + * {@inheritdoc} + */ + public function setWebsite($website) + { + $this->data['website'] = $website; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getWebsite() + { + return $this->data['website']; + } + + /** + * {@inheritdoc} + */ + public function setLogoHash($logoHash) + { + $this->data['logoHash'] = $logoHash; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getLogoHash() + { + return $this->data['logoHash']; + } + + /** + * {@inheritdoc} + */ + public function setPremiumFeatures(array $premiumFeatures) + { + $this->data['premiumFeatures'] = $premiumFeatures; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getPremiumFeatures() + { + return $this->data['premiumFeatures']; + } +} diff --git a/dailymail/src/Trello/Model/OrganizationInterface.php b/dailymail/src/Trello/Model/OrganizationInterface.php new file mode 100644 index 0000000..7a1ddf7 --- /dev/null +++ b/dailymail/src/Trello/Model/OrganizationInterface.php @@ -0,0 +1,251 @@ + 'all', + 'webhooks' => true, + ); + + /** + * {@inheritdoc} + */ + public function getIdentifier() + { + return $this->data['identifier']; + } + + /** + * {@inheritdoc} + */ + public function getMemberId() + { + return $this->data['idMember']; + } + + /** + * {@inheritdoc} + */ + public function getMember() + { + return new Member($this->client, $this->data['idMember']); + } + + /** + * {@inheritdoc} + */ + public function getDateOfCreation() + { + return new \DateTime($this->data['dateCreated']); + } + + /** + * {@inheritdoc} + */ + public function getDateOfExpiry() + { + return new \DateTime($this->data['dateExpires']); + } + + /** + * {@inheritdoc} + */ + public function getPermissions() + { + return $this->data['permissions']; + } + + /** + * {@inheritdoc} + */ + public function getWebhooks() + { + $webhooks = array(); + + foreach ($this->data['webhooks'] as $webhook) { + $webhooks[] = new Webhook($this->client, $webhook['id']); + } + + return $webhooks; + } +} diff --git a/dailymail/src/Trello/Model/TokenInterface.php b/dailymail/src/Trello/Model/TokenInterface.php new file mode 100644 index 0000000..aaaf100 --- /dev/null +++ b/dailymail/src/Trello/Model/TokenInterface.php @@ -0,0 +1,55 @@ +data['description']; + } + + /** + * {@inheritdoc} + */ + public function getModelId() + { + return $this->data['idModel']; + } + + /** + * {@inheritdoc} + */ + public function getCallbackURL() + { + return $this->data['callbackURL']; + } + + /** + * {@inheritdoc} + */ + public function isActive() + { + return $this->data['active']; + } +} diff --git a/dailymail/src/Trello/Model/WebhookInterface.php b/dailymail/src/Trello/Model/WebhookInterface.php new file mode 100644 index 0000000..f255722 --- /dev/null +++ b/dailymail/src/Trello/Model/WebhookInterface.php @@ -0,0 +1,34 @@ +dispatcher = $dispatcher ? $dispatcher : new EventDispatcher(); + } + + /** + * Get event dispatcher + * + * @return EventDispatcherInterface + */ + public function getEventDispatcher() + { + return $this->dispatcher; + } + + /** + * Attach an event listener + * + * @param string $eventName @see Events for name constants + * @param callable $listener The listener + * @param int $priority The higher this value, the earlier an event + * listener will be triggered in the chain (defaults to 0) + */ + public function addListener($eventName, $listener, $priority = 0) + { + $this->dispatcher->addListener($eventName, $listener, $priority); + } + + /** + * Attach an event subscriber + * + * @param EventSubscriberInterface $subscriber The subscriber + */ + public function addEventSubscriber(EventSubscriberInterface $subscriber) + { + $this->dispatcher->addSubscriber($subscriber); + } + + /** + * Checks whether a given request is a Trello webhook + * + * @param Request $request + * + * @return bool + */ + public function isTrelloWebhook(Request $request) + { + if (!$request->getMethod() === 'POST') { + return false; + } + + if (!$request->headers->has('X-Trello-Webhook')) { + return false; + } + + return true; + } + + /** + * Checks whether a given request is a Trello webhook + * and raises appropriate events @see Events + * + * @param Request|null $request + */ + public function handleWebhook(Request $request = null) + { + if (!$request) { + $request = Request::createFromGlobals(); + $data = json_decode($request->getContent(), true); + $request->request->replace($data); + } + + if (!$this->isTrelloWebhook($request) || !$action = $request->get('action')) { + return; + } + + if (!isset($action['type'])) { + throw new InvalidArgumentException('Unable to determine event from request.'); + } + + if (!isset($action['data'])) { + throw new InvalidArgumentException('Unable to retrieve data from request.'); + } + + $eventName = $action['type']; + $data = $action['data']; + + switch ($eventName) { + case Events::BOARD_CREATE: + case Events::BOARD_UPDATE: + case Events::BOARD_COPY: + $event = new Event\BoardEvent(); + $event->setBoard($this->getBoard($data['board']['id'])); + break; + case Events::BOARD_MOVE_CARD_FROM: + case Events::BOARD_MOVE_CARD_TO: + $event = new Event\CardMoveEvent(); + $event->setCard($this->getCard($data['card']['id'])); + break; + case Events::BOARD_MOVE_LIST_FROM: + case Events::BOARD_MOVE_LIST_TO: + $event = new Event\ListMoveEvent(); + $event->setList($this->getList($data['list']['id'])); + break; + case Events::BOARD_ADD_MEMBER: + case Events::BOARD_MAKE_ADMIN: + case Events::BOARD_MAKE_NORMAL_MEMBER: + case Events::BOARD_MAKE_OBSERVER: + case Events::BOARD_REMOVE_ADMIN: + case Events::BOARD_DELETE_INVITATION: + case Events::BOARD_UNCONFIRMED_INVITATION: + $event = new Event\BoardMemberEvent(); + $event->setBoard($this->getBoard($data['board']['id'])); + $event->setMember($this->getMember($data['member']['id'])); + break; + case Events::BOARD_ADD_TO_ORGANIZATION: + case Events::BOARD_REMOVE_FROM_ORGANIZATION: + $event = new Event\BoardOrganizationEvent(); + $event->setBoard($this->getBoard($data['board']['id'])); + $event->setOrganization($this->getOrganization($data['organization']['id'])); + break; + case Events::LIST_CREATE: + case Events::LIST_UPDATE: + case Events::LIST_UPDATE_CLOSED: + case Events::LIST_UPDATE_NAME: + $event = new Event\ListEvent(); + $event->setList($this->getList($data['list']['id'])); + break; + case Events::CARD_CREATE: + case Events::CARD_UPDATE: + case Events::CARD_UPDATE_LIST: + case Events::CARD_UPDATE_NAME: + case Events::CARD_UPDATE_DESC: + case Events::CARD_UPDATE_CLOSED: + case Events::CARD_DELETE: + case Events::CARD_EMAIL: + case Events::CARD_ADD_LABEL: + case Events::CARD_REMOVE_LABEL: + $event = new Event\CardEvent(); + $event->setCard($this->getCard($data['card']['id'])); + break; + case Events::CARD_COPY: + $event = new Event\CardCopyEvent(); + $event->setCard($this->getCard($data['card']['id'])); + break; + case Events::CARD_ADD_MEMBER: + case Events::CARD_REMOVE_MEMBER: + $event = new Event\CardMemberEvent(); + $event->setCard($this->getCard($data['card']['id'])); + $event->setMember($this->getMember($data['member']['id'])); + break; + case Events::CARD_COMMENT: + case Events::CARD_COPY_COMMENT: + $event = new Event\CardCommentEvent(); + $event->setCard($this->getCard($data['card']['id'])); + $event->setComment($data['text']); + break; + case Events::CARD_FROM_CHECKITEM: + $event = new Event\CardFromCheckItemEvent(); + $event->setCard($this->getCard($data['card']['id'])); + break; + case Events::CARD_ADD_ATTACHMENT: + case Events::CARD_DELETE_ATTACHMENT: + $event = new Event\CardAttachmentEvent(); + $event->setCard($this->getCard($data['card']['id'])); + $event->setAttachment($data['attachment']); + break; + case Events::CARD_ADD_CHECKLIST: + case Events::CARD_CREATE_CHECKLIST_ITEM: + case Events::CARD_UPDATE_CHECKLIST_ITEM_STATE: + $event = new Event\CardChecklistEvent(); + $event->setCard($this->getCard($data['card']['id'])); + $event->setChecklist($this->getChecklist($data['checklist']['id'])); + break; + case Events::CARD_CREATE_CHECKLIST: + case Events::CARD_UPDATE_CHECKLIST: + case Events::CARD_REMOVE_CHECKLIST: + $event = new Event\CardChecklistEvent(); + $event->setCard($this->getCard($data['cardTarget']['_id'])); + $event->setChecklist($this->getChecklist($data['checklist']['id'])); + break; + case Events::ORGANIZATION_CREATE: + case Events::ORGANIZATION_UPDATE: + $event = new Event\OrganizationEvent(); + $event->setOrganization($this->getOrganization($data['organization']['id'])); + break; + case Events::ORGANIZATION_ADD_MEMBER: + case Events::ORGANIZATION_MAKE_NORMAL_MEMBER: + case Events::ORGANIZATION_REMOVE_ADMIN: + case Events::ORGANIZATION_DELETE_INVITATION: + case Events::ORGANIZATION_UNCONFIRMED_INVITATION: + $event = new Event\OrganizationMemberEvent(); + $event->setOrganization($this->getOrganization($data['organization']['id'])); + $event->setMember($this->getMember($data['member']['id'])); + break; + case Events::MEMBER_JOINED: + case Events::MEMBER_UPDATE: + $event = new Event\MemberEvent(); + $event->setMember($this->getMember($data['member']['id'])); + break; + case Events::POWERUP_ENABLE: + case Events::POWERUP_DISABLE: + $event = new Event\PowerUpEvent(); + $event->setPowerUp($data['powerUp']); + break; + default: + throw new InvalidArgumentException(sprintf( + 'Unknown event "%s" occured with following data: "%s".', + $eventName, + serialize($data) + )); + } + + $event->setRequestData($data); + + $this->dispatcher->dispatch($eventName, $event); + } +} diff --git a/dailymail/symfony.lock b/dailymail/symfony.lock index 8b86b05..8e8c3c1 100644 --- a/dailymail/symfony.lock +++ b/dailymail/symfony.lock @@ -1,7 +1,4 @@ { - "cdaguerre/php-trello-api": { - "version": "dev-master" - }, "doctrine/annotations": { "version": "1.0", "recipe": { @@ -59,12 +56,48 @@ "doctrine/orm": { "version": "v2.6.1" }, + "easycorp/easyadmin-bundle": { + "version": "1.17", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "master", + "version": "1.17", + "ref": "66070ea553247b0cd5275e21d0fe5399a25f40be" + } + }, + "firebase/php-jwt": { + "version": "v5.0.0" + }, + "google/apiclient": { + "version": "2.0", + "recipe": { + "repo": "github.com/symfony/recipes-contrib", + "branch": "master", + "version": "2.0", + "ref": "49c5d7a66d863d28513979bf0666dc77599100c0" + } + }, + "google/apiclient-services": { + "version": "v0.57" + }, + "google/auth": { + "version": "v1.3.0" + }, "guzzlehttp/guzzle": { "version": "v3.8.1" }, + "guzzlehttp/promises": { + "version": "v1.3.1" + }, + "guzzlehttp/psr7": { + "version": "1.4.2" + }, "jdorn/sql-formatter": { "version": "v1.2.17" }, + "monolog/monolog": { + "version": "1.23.0" + }, "nikic/php-parser": { "version": "v4.0.1" }, @@ -74,12 +107,21 @@ "ocramius/proxy-manager": { "version": "2.1.1" }, + "pagerfanta/pagerfanta": { + "version": "v1.1.0" + }, + "phpseclib/phpseclib": { + "version": "2.0.11" + }, "psr/cache": { "version": "1.0.1" }, "psr/container": { "version": "1.0.0" }, + "psr/http-message": { + "version": "1.0.1" + }, "psr/log": { "version": "1.0.2" }, @@ -123,7 +165,7 @@ "version": "v4.0.8" }, "symfony/dotenv": { - "version": "v4.0.8" + "version": "v4.0.9" }, "symfony/event-dispatcher": { "version": "v4.0.8" @@ -209,8 +251,14 @@ "ref": "cda8b550123383d25827705d05a42acf6819fe4e" } }, - "symfony/security-core": { - "version": "v4.0.8" + "symfony/security-bundle": { + "version": "3.3", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "master", + "version": "3.3", + "ref": "f8a63faa0d9521526499c0a8f403c9964ecb0527" + } }, "symfony/security-csrf": { "version": "v4.0.8" @@ -257,6 +305,15 @@ "symfony/yaml": { "version": "v4.0.8" }, + "twig/extensions": { + "version": "1.0", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "master", + "version": "1.0", + "ref": "4851df0afc426b8f07204379d21fca25b6df5d68" + } + }, "twig/twig": { "version": "v2.4.8" }, diff --git a/dailymail/templates/Developper/_delete_form.html.twig b/dailymail/templates/Developper/_delete_form.html.twig deleted file mode 100644 index 6a39b8b..0000000 --- a/dailymail/templates/Developper/_delete_form.html.twig +++ /dev/null @@ -1,5 +0,0 @@ -
- - - -
\ No newline at end of file diff --git a/dailymail/templates/Developper/_form.html.twig b/dailymail/templates/Developper/_form.html.twig deleted file mode 100644 index 92948ad..0000000 --- a/dailymail/templates/Developper/_form.html.twig +++ /dev/null @@ -1,4 +0,0 @@ -{{ form_start(form) }} - {{ form_widget(form) }} - -{{ form_end(form) }} \ No newline at end of file diff --git a/dailymail/templates/Developper/edit.html.twig b/dailymail/templates/Developper/edit.html.twig deleted file mode 100644 index 8157f98..0000000 --- a/dailymail/templates/Developper/edit.html.twig +++ /dev/null @@ -1,13 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block title %}Edit Developper{% endblock %} - -{% block body %} -

Edit Developper

- - {{ include('developper/_form.html.twig', {'button_label': 'Update'}) }} - - back to list - - {{ include('developper/_delete_form.html.twig') }} -{% endblock %} \ No newline at end of file diff --git a/dailymail/templates/Developper/index.html.twig b/dailymail/templates/Developper/index.html.twig deleted file mode 100644 index 26e02eb..0000000 --- a/dailymail/templates/Developper/index.html.twig +++ /dev/null @@ -1,80 +0,0 @@ -{% extends "base.html.twig" %} - -{% block stylesheets %} - {{ parent() }} - -{% endblock %} - -{% block body %} -
-
-
-
-
-
- -
- - - - - - - - - - - - {% for developper in developpers %} - - - - - - - - {% else %} - - - - {% endfor %} - -
MembreCréé leRôleEmail 
- - {{ developper.firstName }} {{ developper.lastName }} - Member - 2013/08/12 - pending - - {{ developper.email }} - - - - - - - - - - - - - - - - - - - -
no records found
-
-
-
-
-
-
- -
-{% endblock %} diff --git a/dailymail/templates/Developper/new.html.twig b/dailymail/templates/Developper/new.html.twig deleted file mode 100644 index 4522d3a..0000000 --- a/dailymail/templates/Developper/new.html.twig +++ /dev/null @@ -1,11 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block title %}New Developper{% endblock %} - -{% block body %} -

Create new Developper

- - {{ include('Developper/_form.html.twig') }} - - back to list -{% endblock %} \ No newline at end of file diff --git a/dailymail/templates/Developper/show.html.twig b/dailymail/templates/Developper/show.html.twig deleted file mode 100644 index 98c5a3f..0000000 --- a/dailymail/templates/Developper/show.html.twig +++ /dev/null @@ -1,34 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block title %}Developper{% endblock %} - -{% block body %} -

Developper

- - - - - - - - - - - - - - - - - - - - -
Id{{ developper.id }}
firstName{{ developper.firstName }}
lastName{{ developper.lastName }}
Email{{ developper.email }}
- - back to list - - edit - - {{ include('Developper/_delete_form.html.twig') }} -{% endblock %} \ No newline at end of file diff --git a/dailymail/templates/base.html.twig b/dailymail/templates/base.html.twig index f801127..85adfde 100644 --- a/dailymail/templates/base.html.twig +++ b/dailymail/templates/base.html.twig @@ -33,8 +33,6 @@ {% endblock %} - - @@ -49,19 +47,6 @@ -
diff --git a/dailymail/templates/google_sheet.html.twig b/dailymail/templates/google_sheet.html.twig new file mode 100644 index 0000000..951cbcc --- /dev/null +++ b/dailymail/templates/google_sheet.html.twig @@ -0,0 +1,16 @@ +{% extends "base.html.twig" %} + +{% block body %} +
+
+

Google sheet + Generator +

+
+ Display google chart from Daily Mail Sheet +
+
+ + +
+{% endblock %} \ No newline at end of file diff --git a/dailymail/templates/home.html.twig b/dailymail/templates/home.html.twig index a0759db..2dc94f7 100644 --- a/dailymail/templates/home.html.twig +++ b/dailymail/templates/home.html.twig @@ -13,5 +13,7 @@ This tool will help you to generate a daily mail from Trello/Google sheet information.

+ + {% endblock %} \ No newline at end of file diff --git a/dailymail/templates/project/_delete_form.html.twig b/dailymail/templates/project/_delete_form.html.twig deleted file mode 100644 index 6f0e183..0000000 --- a/dailymail/templates/project/_delete_form.html.twig +++ /dev/null @@ -1,5 +0,0 @@ -
- - - -
\ No newline at end of file diff --git a/dailymail/templates/project/_form.html.twig b/dailymail/templates/project/_form.html.twig deleted file mode 100644 index 92948ad..0000000 --- a/dailymail/templates/project/_form.html.twig +++ /dev/null @@ -1,4 +0,0 @@ -{{ form_start(form) }} - {{ form_widget(form) }} - -{{ form_end(form) }} \ No newline at end of file diff --git a/dailymail/templates/project/edit.html.twig b/dailymail/templates/project/edit.html.twig deleted file mode 100644 index c10b30d..0000000 --- a/dailymail/templates/project/edit.html.twig +++ /dev/null @@ -1,13 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block title %}Edit Project{% endblock %} - -{% block body %} -

Edit Project

- - {{ include('project/_form.html.twig', {'button_label': 'Update'}) }} - - back to list - - {{ include('project/_delete_form.html.twig') }} -{% endblock %} \ No newline at end of file diff --git a/dailymail/templates/project/index.html.twig b/dailymail/templates/project/index.html.twig deleted file mode 100644 index 9dd30c6..0000000 --- a/dailymail/templates/project/index.html.twig +++ /dev/null @@ -1,41 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block title %}Project index{% endblock %} - -{% block body %} -

Project index

- - - - - - - - - - - - - - {% for project in projects %} - - - - - - - - - {% else %} - - - - {% endfor %} - -
IdNameCustomerTrelloKeyGoogleKeyactions
{{ project.id }}{{ project.name }}{{ project.customer }}{{ project.trelloKey }}{{ project.googleKey }} - show - edit -
no records found
- - Create new -{% endblock %} \ No newline at end of file diff --git a/dailymail/templates/project/new.html.twig b/dailymail/templates/project/new.html.twig deleted file mode 100644 index cc582bd..0000000 --- a/dailymail/templates/project/new.html.twig +++ /dev/null @@ -1,11 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block title %}New Project{% endblock %} - -{% block body %} -

Create new Project

- - {{ include('project/_form.html.twig') }} - - back to list -{% endblock %} \ No newline at end of file diff --git a/dailymail/templates/project/show.html.twig b/dailymail/templates/project/show.html.twig deleted file mode 100644 index 1f35f47..0000000 --- a/dailymail/templates/project/show.html.twig +++ /dev/null @@ -1,38 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block title %}Project{% endblock %} - -{% block body %} -

Project

- - - - - - - - - - - - - - - - - - - - - - - - -
Id{{ project.id }}
Name{{ project.name }}
Customer{{ project.customer }}
TrelloKey{{ project.trelloKey }}
GoogleKey{{ project.googleKey }}
- - back to list - - edit - - {{ include('project/_delete_form.html.twig') }} -{% endblock %} \ No newline at end of file