Skip to content

Commit

Permalink
Merge branch 'master' into feat-141
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanbrauer committed Dec 2, 2019
2 parents e81657d + 6278a31 commit 91e1ea4
Show file tree
Hide file tree
Showing 273 changed files with 1,684 additions and 48 deletions.
99 changes: 76 additions & 23 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,94 @@ version: 2
jobs:
"php-7.1":
docker:
# Specify the version you desire here
- image: circleci/php:7.1-node-browsers

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# Using the RAM variation mitigates I/O contention
# for database intensive operations.
# - image: circleci/mysql:5.7-ram
#
# - image: redis:2.8.19

- image: circleci/php:7.1.30
steps:
- checkout

- run: sudo apt update # PHP CircleCI 2.0 Configuration File# PHP CircleCI 2.0 Configuration File sudo apt install zlib1g-dev libsqlite3-dev
- run: sudo apt update
- run: sudo docker-php-ext-install bcmath

# Download and cache dependencies
- restore_cache:
keys:
# "composer.lock" can be used if it is committed to the repo
- v1-dependencies-{{ checksum "composer.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run: composer self-update --stable --no-interaction
- run: sudo composer self-update --stable --no-interaction
- run: composer install --no-suggest --no-interaction --prefer-dist
- run: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- run: chmod +x ./cc-test-reporter
- run: ./cc-test-reporter before-build

- save_cache:
key: v1-dependencies-{{ checksum "composer.json" }}
paths:
- ./vendor

# run tests with phpunit or codecept
- run: composer clover
- run: ./cc-test-reporter after-build --coverage-input-type clover --exit-code $?
"php-7.2":
docker:
- image: circleci/php:7.2.20
steps:
- checkout
- run: sudo apt update
- run: sudo docker-php-ext-install bcmath
- restore_cache:
keys:
- v1-dependencies-{{ checksum "composer.json" }}
- v1-dependencies-
- run: sudo composer self-update --stable --no-interaction
- run: composer install --no-suggest --no-interaction --prefer-dist
- run: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- run: chmod +x ./cc-test-reporter
- run: ./cc-test-reporter before-build
- save_cache:
key: v1-dependencies-{{ checksum "composer.json" }}
paths:
- ./vendor
- run: composer clover
- run: ./cc-test-reporter after-build --coverage-input-type clover --exit-code $?
"php-7.3":
docker:
- image: circleci/php:7.3.7
steps:
- checkout
- run: sudo apt update
- run: sudo docker-php-ext-install bcmath
- restore_cache:
keys:
# "composer.lock" can be used if it is committed to the repo
- v2-dependencies-{{ checksum "composer.json" }}
# fallback to using the latest cache if no exact match is found
- v2-dependencies-
- run: sudo composer self-update --stable --no-interaction
- run: composer install --no-suggest --no-interaction --prefer-dist
- run: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- run: chmod +x ./cc-test-reporter
- run: ./cc-test-reporter before-build
- save_cache:
key: v2-dependencies-{{ checksum "composer.json" }}
paths:
- ./vendor
- run: composer clover
- run: ./cc-test-reporter after-build --coverage-input-type clover --exit-code $?
"php-7.4":
docker:
- image: circleci/php:7.4.0
steps:
- checkout
- run: sudo apt update
- run: sudo docker-php-ext-install bcmath
- restore_cache:
keys:
# "composer.lock" can be used if it is committed to the repo
- v2-dependencies-{{ checksum "composer.json" }}
# fallback to using the latest cache if no exact match is found
- v2-dependencies-
- run: sudo composer self-update --stable --no-interaction
- run: composer install --no-suggest --no-interaction --prefer-dist
- run: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- run: chmod +x ./cc-test-reporter
- run: ./cc-test-reporter before-build
- save_cache:
key: v2-dependencies-{{ checksum "composer.json" }}
paths:
- ./vendor
- run: composer clover
- run: ./cc-test-reporter after-build --coverage-input-type clover --exit-code $?

Expand All @@ -52,3 +102,6 @@ workflows:
build_and_test:
jobs:
- "php-7.1"
- "php-7.2"
- "php-7.3"
- "php-7.4"
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Latest Stable Version](https://poser.pugx.org/jordanbrauer/unit-converter/version?format=flat-square)](https://packagist.org/packages/jordanbrauer/unit-converter)
[![Latest Unstable Version](https://poser.pugx.org/jordanbrauer/unit-converter/v/unstable?format=flat-square)](//packagist.org/packages/jordanbrauer/unit-converter)
[![Travis](https://img.shields.io/travis/jordanbrauer/unit-converter.svg?style=flat-square)](https://travis-ci.org/jordanbrauer/unit-converter)
[![CircleCI](https://img.shields.io/circleci/build/github/jordanbrauer/unit-converter/master?label=tests&style=flat-square)](https://circleci.com/gh/jordanbrauer/unit-converter/tree/master)
[![Code Maintainability](https://img.shields.io/codeclimate/maintainability/jordanbrauer/unit-converter.svg?style=flat-square)](https://codeclimate.com/github/jordanbrauer/unit-converter)
[![Code Coverage](https://img.shields.io/codeclimate/coverage/jordanbrauer/unit-converter.svg?style=flat-square)](https://codeclimate.com/github/jordanbrauer/unit-converter)
[![Technical Debt](https://img.shields.io/codeclimate/tech-debt/jordanbrauer/unit-converter.svg?style=flat-square)](https://codeclimate.com/github/jordanbrauer/unit-converter/issues)
Expand Down Expand Up @@ -35,10 +35,10 @@ It supports the following types of measurement by default (support for more meas

- Area
- Data Transfer Rates _Coming Soon!_
- Digital Storage _Coming Soon!_
- Digital Storage **_New!_**
- Energy (Power)
- Frequency **_New!_**
- Fuel Economy **_New!_**
- Frequency
- Fuel Economy
- Length
- Mass (Weight)
- Plane Angle (Rotation)
Expand Down
20 changes: 20 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Security Policy

This library has no real reason for security concerns. That being said, it does pull in dependencies from third-parties for development. In the event that a package is compromised, this document will tell you what can be done to help your situation.

## Supported Versions

This table lists the versions of this library that currently receive support for security fixes.

| Version | Supported |
| ------- | ------------------ |
| `0.8.x` | ✔︎ |
| `0.7.x` | 𝗫 |
| `0.6.x` | 𝗫 |
| `0.5.x` | 𝗫 |
| `0.4.x` | 𝗫 |
| `0.3.x` | 𝗫 |

## Reporting a Vulnerability

If you find a security vulnerability in this package, you can report it on [the official GitHub page issue tracker](https://github.com/jordanbrauer/unit-converter/issues). Typically issues are replied to within a day or two, and addressed when based on severity.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
},
"autoload": {
"psr-4": {
"UnitConverter\\": "src/UnitConverter/"
"UnitConverter\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"UnitConverter\\Tests\\Integration\\": "tests/integration/UnitConverter/",
"UnitConverter\\Tests\\Unit\\": "tests/unit/UnitConverter/"
"UnitConverter\\Tests\\Integration\\": "tests/integration/",
"UnitConverter\\Tests\\Unit\\": "tests/unit/"
}
}
}
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@
*/
class ToMilesPerGallon extends AbstractFormula
{

const MAGIC_NUMBER = 2.35215;

const FORMULA_STRING = 'mpg = 2.35215 * km/l';

const FORMULA_TEMPLATE = '%s mpg = 2.35215 * %skm/l';

const MAGIC_NUMBER = 2.35215;

/**
* {@inheritDoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@
*/
class ToMilesPerGallon extends AbstractFormula
{

const MAGIC_NUMBER = 235.215;

const FORMULA_STRING = 'mpg = 235.215 / L/100km';

const FORMULA_TEMPLATE = '%s mpg = 235.215 / %sL/100km';

const MAGIC_NUMBER = 235.215;

/**
* {@inheritDoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@
*/
class ToKilometrePerLitre extends AbstractFormula
{

const MAGIC_NUMBER = 0.425144;

const FORMULA_STRING = 'km/l = 0.425144 * mpg';

const FORMULA_TEMPLATE = '%s km/l = 0.425144 * %smpg';

const MAGIC_NUMBER = 0.425144;

/**
* {@inheritDoc}
*/
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 30 additions & 0 deletions src/UnitConverter/Measure.php → src/Measure.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@
use UnitConverter\Unit\Area\SquareMetre;
use UnitConverter\Unit\Area\SquareMile;
use UnitConverter\Unit\Area\SquareMillimetre;
use UnitConverter\Unit\DigitalStorage\Bit;
use UnitConverter\Unit\DigitalStorage\Gibibit;
use UnitConverter\Unit\DigitalStorage\Gigabit;
use UnitConverter\Unit\DigitalStorage\Gigabyte;
use UnitConverter\Unit\DigitalStorage\Kibibit;
use UnitConverter\Unit\DigitalStorage\Kilobit;
use UnitConverter\Unit\DigitalStorage\Kilobyte;
use UnitConverter\Unit\DigitalStorage\Mebibit;
use UnitConverter\Unit\DigitalStorage\Megabit;
use UnitConverter\Unit\DigitalStorage\Megabyte;
use UnitConverter\Unit\DigitalStorage\Tebibit;
use UnitConverter\Unit\DigitalStorage\Terabit;
use UnitConverter\Unit\DigitalStorage\Terabyte;
use UnitConverter\Unit\Energy\Calorie;
use UnitConverter\Unit\Energy\FootPound;
use UnitConverter\Unit\Energy\Joule;
Expand Down Expand Up @@ -112,6 +125,8 @@ class Measure
{
const AREA = "area";

const DIGITAL_STORAGE = "digital_storage";

const ENERGY = "energy";

const FREQUENCY = 'frequency';
Expand Down Expand Up @@ -245,6 +260,21 @@ class Measure
Terahertz::class,
Millihertz::class,
],
self::DIGITAL_STORAGE => [
Bit::class,
Kilobit::class,
Megabit::class,
Gigabit::class,
Terabit::class,
Kibibit::class,
Mebibit::class,
Gibibit::class,
Tebibit::class,
Kilobyte::class,
Megabyte::class,
Gigabyte::class,
Terabyte::class,
],
];

/**
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
37 changes: 37 additions & 0 deletions src/Unit/DigitalStorage/Bit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types = 1);

/**
* This file is part of the jordanbrauer/unit-converter PHP package.
*
* @copyright 2018 Jordan Brauer <18744334+jordanbrauer@users.noreply.github.com>
* @license MIT
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace UnitConverter\Unit\DigitalStorage;

/**
* Bit unit data class
*
* @version 1.0.0
* @since 0.8.4
* @author Laurent Clouet <https://github.com/laurent35240>
*/
class Bit extends DigitalStorageUnit
{
protected function configure(): void
{
$this
->setName("bit")

->setSymbol("b")

->setScientificSymbol("b")

->setUnits(1);
}
}
37 changes: 37 additions & 0 deletions src/Unit/DigitalStorage/Byte.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types = 1);

/**
* This file is part of the jordanbrauer/unit-converter PHP package.
*
* @copyright 2018 Jordan Brauer <18744334+jordanbrauer@users.noreply.github.com>
* @license MIT
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace UnitConverter\Unit\DigitalStorage;

/**
* Byte unit data class
*
* @version 1.0.0
* @since 0.8.4
* @author Laurent Clouet <https://github.com/laurent35240>
*/
class Byte extends DigitalStorageUnit
{
protected function configure(): void
{
$this
->setName("byte")

->setSymbol("B")

->setScientificSymbol("B")

->setUnits(8);
}
}
Loading

0 comments on commit 91e1ea4

Please sign in to comment.