Skip to content

Commit

Permalink
:octocat:
Browse files Browse the repository at this point in the history
  • Loading branch information
codemasher committed Jun 12, 2017
0 parents commit bd4ca1b
Show file tree
Hide file tree
Showing 35 changed files with 4,126 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
engines:
fixme:
enabled: true
phpmd:
enabled: true
config:
file_extensions: "php"
rulesets: "phpmd.xml"
markdownlint:
enabled: true
ratings:
paths:
- "**.php"
exclude_paths:
- config/**/*
- examples/**/*
- tests/**/*
- "**/vendor/**/*"
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.idea
vendor
config/.env
composer.lock

*.pdf
_stuff
5 changes: 5 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
filter:
excluded_paths:
- config/*
- examples/*
- tests/*
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: php

php:
- 7.0
- 7.1

before_install: pip install --user codecov
install: travis_retry composer install --no-interaction --prefer-source
script: vendor/bin/phpunit --configuration phpunit.xml --coverage-clover clover.xml
after_success: codecov
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 Smiley <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# php-webfleet

A wrapper for the [TomTom Business Webfleet.connect API](https://business.tomtom.com/partners/integration/resources/).

## Requirements
- a TomTom Business account
- PHP 7+
30 changes: 30 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "codemasher/php-webfleet",
"description": "A wrapper for the TomTom Business Webfleet.connect API. PHP 7+",
"homepage": "https://github.com/codemasher/php-webfleet",
"license": "MIT",
"type": "library",
"keywords": [
"webfleet", "tomtom", "telematics" ,"api", "wrapper"
],
"authors": [
{
"name": "Smiley",
"email": "[email protected]"
}
],
"require": {
"php": ">=7.0.3",
"chillerlan/php-curl": "dev-master",
"vlucas/phpdotenv": "2.*"
},
"require-dev": {
"phpunit/phpunit": "6.0.*"
},
"autoload": {
"psr-4": {
"TomTom\\Telematics\\": "src",
"TomTom\\TelematicsTest\\": "tests"
}
}
}
4 changes: 4 additions & 0 deletions config/.env_example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
WEBFLEET_ACCOUNT=
WEBFLEET_USERNAME=
WEBFLEET_PASSWORD=
WEBFLEET_APIKEY=
27 changes: 27 additions & 0 deletions phpmd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0"?>
<ruleset name="codemasher/php-webfleet PMD ruleset"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>codemasher/php-webfleet PMD ruleset</description>
<exclude-pattern>*/config/*</exclude-pattern>
<exclude-pattern>*/examples/*</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
<rule ref="rulesets/cleancode.xml"/>
<rule ref="rulesets/codesize.xml"/>
<rule ref="rulesets/design.xml"/>
<rule ref="rulesets/controversial.xml">
<exclude name="CamelCaseMethodName"/>
<exclude name="CamelCasePropertyName"/>
<exclude name="CamelCaseParameterName"/>
<exclude name="CamelCaseVariableName"/>
</rule>
<rule ref="rulesets/naming.xml">
<exclude name="LongVariable"/>
<exclude name="ShortVariable"/>
</rule>
<rule ref="rulesets/unusedcode.xml">
<exclude name="UnusedFormalParameter"/>
</rule>
</ruleset>
23 changes: 23 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
<testsuites>
<testsuite name="php-webfleet test suite">
<directory suffix=".php">./tests</directory>
</testsuite>
</testsuites>
</phpunit>
79 changes: 79 additions & 0 deletions src/Container.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php
/**
* Class Container
*
* @filesource Container.php
* @created 14.03.2017
* @package TomTom\Telematics
* @author Smiley <[email protected]>
* @copyright 2017 Smiley
* @license MIT
*/

namespace TomTom\Telematics;

/**
* a generic container with getter and setter
*/
abstract class Container{

/**
* Boa constructor.
*
* @param array $properties
*/
public function __construct(array $properties = []){

foreach($properties as $key => $value){
$this->__set($key, $value);
}

}

/**
* David Getter
*
* @param string $property
*
* @return mixed|bool
*/
public function __get(string $property){

if(property_exists($this, $property)){
return $this->{$property};
}

return false;
}

/**
* Jet-setter
*
* @param string $property
* @param mixed $value
*
* @return void
*/
public function __set(string $property, $value){

if(property_exists($this, $property)){
$this->{$property} = $value;
}

}

/**
* @return array
*/
public function __toArray():array{

$arr = [];

foreach($this as $key => $val){
$arr[$key] = $val;
}

return $arr;
}

}
Loading

0 comments on commit bd4ca1b

Please sign in to comment.