Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mipapo committed Sep 21, 2017
0 parents commit e00bdfe
Show file tree
Hide file tree
Showing 60 changed files with 1,288 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.scrutinizer.yml export-ignore
.travis.yml export-ignore
phpunit.xml.dist export-ignore
src/Tests export-ignore
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vendor/
composer.lock
27 changes: 27 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

$header = <<<EOF
This file is part of the Runalyze Device List.
(c) RUNALYZE <mail@runalyze.com>
This source file is subject to the MIT license that is bundled
with this source code in the file LICENSE.
EOF;

Symfony\CS\Fixer\Contrib\HeaderCommentFixer::setHeader($header);

return Symfony\CS\Config\Config::create()
->fixers(array(
'header_comment',
'ordered_use',
'php_unit_construct',
'strict',
'strict_param',
'-phpdoc_separation',
))
->finder(
Symfony\CS\Finder\DefaultFinder::create()
->in(__DIR__.DIRECTORY_SEPARATOR.'src')
)
;
10 changes: 10 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
filter:
paths: [src/*]
excluded_paths:
- src/Tests/*
tools:
php_analyzer: true
php_mess_detector: true
php_pdepend: true
external_code_coverage:
timeout: '600'
27 changes: 27 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
language: php

php:
- 5.5
- 5.6
- 7.0
- 7.1

sudo: false

cache:
directories:
- vendor
- $HOME/.composer/cache

before_install:
- mkdir -p build/logs

install:
- composer install --prefer-dist --no-interaction

script:
- phpunit --coverage-clover build/logs/clover.xml
- vendor/bin/php-cs-fixer fix -v --diff --dry-run

after_script:
- wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
32 changes: 32 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## Running Unit Tests

This library uses [phpunit](https://phpunit.de/) for automated tests.
`phpunit` is installed by default via Composer.

To run checks:

```console
$ ./vendor/bin/phpunit
```

## Running Coding Standards Checks

This component uses [php-cs-fixer](http://cs.sensiolabs.org/) for coding
standards checks, and provides configuration for our selected checks.
`php-cs-fixer` is installed by default via Composer.

To run checks only:

```console
$ ./vendor/bin/php-cs-fixer fix . -v --diff --dry-run --config-file=.php_cs
```

To have `php-cs-fixer` attempt to fix problems for you, omit the `--dry-run`
flag:

```console
$ ./vendor/bin/php-cs-fixer fix . -v --diff --config-file=.php_cs
```

If you allow php-cs-fixer to fix CS issues, please re-run the tests to ensure
they pass, and make sure you add and commit the changes after verification.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 RUNALYZE

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.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Devices (in progress)

[![Latest Stable Version](https://img.shields.io/packagist/v/runalyze/devices.svg)](https://packagist.org/packages/runalyze/devices)
[![Build Status](https://travis-ci.org/Runalyze/devices.svg?branch=master)](https://travis-ci.org/Runalyze/devices)
[![Code Coverage](https://scrutinizer-ci.com/g/Runalyze/devices/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/Runalyze/devices/?branch=master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Runalyze/devices/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Runalyze/devices/?branch=master)
[![MIT License](https://img.shields.io/github/license/twbs/bootlint.svg)](https://github.com/Runalyze/devices/blob/master/LICENSE)





## License

* Code released under [the MIT license](LICENSE).
19 changes: 19 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

{
"name": "runalyze/devices",
"description": "Runalyze Device List",
"license": "MIT",
"require": {
"php": ">=5.5.9",
"runalyze/common": "dev-master"
},
"require-dev": {
"phpunit/phpunit": "4.8.*",
"friendsofphp/php-cs-fixer": "^1.11"
},
"autoload": {
"psr-4": {
"Runalyze\\Devices\\": "src/"
}
}
}
17 changes: 17 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="vendor/autoload.php" colors="true">
<testsuites>
<testsuite name="Runalyze Device List">
<directory suffix="Test.php">./src/Tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<exclude>
<directory>./src/Tests/</directory>
</exclude>
<directory>./src/</directory>
</whitelist>
</filter>
</phpunit>
23 changes: 23 additions & 0 deletions src/Device/AbstractDevice.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace Runalyze\Devices\Device;

use Runalyze\Devices\Distributor\DistributorProfile;

abstract class AbstractDevice implements DeviceInterface
{
public function getFullName()
{
return $this->getDistributor.' '.$this->getName();
}

public function getDistributor()
{
return DistributorProfile::get($this->getDistributorEnum());
}

public function hasBarometer()
{
return false;
}
}
42 changes: 42 additions & 0 deletions src/Device/DeviceInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace Runalyze\Devices\Device;

use Runalyze\Devices\Distributor\DistributorInterface;

interface DeviceInterface
{
/**
* @return int
*/
public function getEnum();

/**
* @return string
*/
public function getName();

/**
* @return string device name with distributor name as prefix
*
* @codeCoverageIgnore
*/
public function getFullName();

/**
* @return int
*/
public function getDistributorEnum();

/**
* @return DistributorInterface
*/
public function getDistributor();

/**
* @return bool
*
* @codeCoverageIgnore
*/
public function hasBarometer();
}
123 changes: 123 additions & 0 deletions src/Device/DeviceProfile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<?php

namespace Runalyze\Devices\Device;

use Runalyze\Common\Enum\AbstractEnum;
use Runalyze\Common\Enum\AbstractEnumFactoryTrait;

class DeviceProfile extends AbstractEnum
{
use AbstractEnumFactoryTrait;

/** @var int */
const GARMIN_FORERUNNER_10 = 1;

/** @var int */
const GARMIN_FORERUNNER_15 = 2;

/** @var int */
const GARMIN_FORERUNNER_25 = 3;

/** @var int */
const GARMIN_FORERUNNER_35 = 4;

/** @var int */
const GARMIN_FORERUNNER_70 = 5;

/** @var int */
const GARMIN_FORERUNNER_110 = 6;

/** @var int */
const GARMIN_FORERUNNER_205 = 7;

/** @var int */
const GARMIN_FORERUNNER_210 = 8;

/** @var int */
const GARMIN_FORERUNNER_220 = 9;

/** @var int */
const GARMIN_FORERUNNER_225 = 10;

/** @var int */
const GARMIN_FORERUNNER_230 = 11;

/** @var int */
const GARMIN_FORERUNNER_235 = 12;

/** @var int */
const GARMIN_FORERUNNER_305 = 13;

/** @var int */
const GARMIN_FORERUNNER_310_X_T = 14;

/** @var int */
const GARMIN_FORERUNNER_405 = 15;

/** @var int */
const GARMIN_FORERUNNER_410 = 16;

/** @var int */
const GARMIN_FORERUNNER_610 = 17;

/** @var int */
const GARMIN_FORERUNNER_620 = 18;

/** @var int */
const GARMIN_FORERUNNER_630 = 19;

/** @var int */
const GARMIN_FORERUNNER_735_X_T = 20;

/** @var int */
const GARMIN_FORERUNNER_910_X_T = 21;

/** @var int */
const GARMIN_FORERUNNER_920_X_T = 22;

/** @var int */
const GARMIN_FORERUNNER_935_X_T = 23;

/** @var int */
const GARMIN_EDGE_25 = 24;

/** @var int */
const GARMIN_EDGE_200 = 25;

/** @var int */
const GARMIN_EDGE_500 = 26;

/** @var int */
const GARMIN_EDGE_520 = 27;

/** @var int */
const GARMIN_EDGE_705 = 28;

/** @var int */
const GARMIN_EDGE_800 = 29;

/** @var int */
const GARMIN_EDGE_810 = 30;

/** @var int */
const GARMIN_EDGE_1000 = 31;

/** @var int */
const GARMIN_FENIX_2 = 32;

/** @var int */
const GARMIN_FENIX_3 = 33;

/** @var int */
const GARMIN_FENIX_5 = 34;

/** @var int */
const GARMIN_FENIX_5_S = 35;

/** @var int */
const GARMIN_FENIX_5_X = 36;

/** @var int */
const GARMIN_EDGE_20 = 37;

}
13 changes: 13 additions & 0 deletions src/Device/GarminDeviceTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Runalyze\Devices\Device;

use Runalyze\Devices\Distributor\DistributorProfile;

trait GarminDeviceTrait
{
public function getDistributorEnum()
{
return DistributorProfile::GARMIN;
}
}
Loading

0 comments on commit e00bdfe

Please sign in to comment.