Skip to content

Commit c63179f

Browse files
committed
Merge branch 'release/0.7.1'
2 parents 46740a1 + 57b4765 commit c63179f

File tree

19 files changed

+269
-197
lines changed

19 files changed

+269
-197
lines changed

.github/workflows/ci.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: CI
2+
3+
on: [push]
4+
5+
jobs:
6+
build-test:
7+
runs-on: ubuntu-latest
8+
container:
9+
image: php:8.4 # This forces the job to run in a Docker container
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
15+
- name: Install System Dependencies (Git, Zip, Unzip)
16+
run: |
17+
apt-get update
18+
apt-get install -y unzip git zip
19+
20+
- name: Install and Enable extensions
21+
run: |
22+
docker-php-ext-install sockets calendar
23+
docker-php-ext-enable sockets calendar
24+
25+
- name: Install Composer
26+
run: |
27+
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
28+
composer --version
29+
30+
- name: Install Dependencies
31+
run: composer install --prefer-dist --no-progress
32+
33+
- name: Run PHPUnit
34+
run: vendor/bin/phpunit tests

.travis.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

.version.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"strategy": "semver",
3+
"major": 0,
4+
"minor": 7,
5+
"patch": 1,
6+
"build": 0
7+
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Build Status](https://app.travis-ci.com/Neuron-PHP/formatting.svg?token=F8zCwpT7x7Res7J2N4vF&branch=master)](https://app.travis-ci.com/Neuron-PHP/formatting)
1+
[![CI](https://github.com/Neuron-PHP/formatting/actions/workflows/ci.yml/badge.svg)](https://github.com/Neuron-PHP/formatting/actions)
22

33
# Neuron-PHP Formatting
44

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"require": {
1313
"ext-curl": "*",
1414
"ext-json": "*",
15-
"neuron-php/core": "^0.7.0"
15+
"neuron-php/core": "0.8.*"
1616
},
1717
"require-dev": {
1818
"phpunit/phpunit": "9.*"

src/Formatters/Currency.php

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99

1010
class Currency implements IFormatter
1111
{
12-
private string $_Format;
13-
private int $_PadLength;
14-
private string $_PadCharacter;
15-
private string $_CurrencySymbol;
12+
private string $_format;
13+
private int $_padLength;
14+
private string $_padCharacter;
15+
private string $_currencySymbol;
1616

1717
public function __construct()
1818
{
@@ -25,87 +25,95 @@ public function __construct()
2525
/**
2626
* @return string
2727
*/
28+
2829
public function getPadCharacter(): string
2930
{
30-
return $this->_PadCharacter;
31+
return $this->_padCharacter;
3132
}
3233

3334
/**
34-
* @param string $PadCharacter
35-
* @return
35+
* @param string $padCharacter
36+
* @return Currency
3637
*/
37-
public function setPadCharacter( string $PadCharacter ): Currency
38+
39+
public function setPadCharacter( string $padCharacter ): Currency
3840
{
39-
$this->_PadCharacter = $PadCharacter;
41+
$this->_padCharacter = $padCharacter;
4042
return $this;
4143
}
4244

4345
/**
4446
* @return string
4547
*/
48+
4649
public function getCurrencySymbol(): string
4750
{
48-
return $this->_CurrencySymbol;
51+
return $this->_currencySymbol;
4952
}
5053

5154
/**
52-
* @param string $CurrencySymbol
55+
* @param string $currencySymbol
5356
* @return Currency
5457
*/
55-
public function setCurrencySymbol( string $CurrencySymbol ): Currency
58+
59+
public function setCurrencySymbol( string $currencySymbol ): Currency
5660
{
57-
$this->_CurrencySymbol = $CurrencySymbol;
61+
$this->_currencySymbol = $currencySymbol;
5862
return $this;
5963
}
6064

6165
/**
6266
* @return string
6367
*/
68+
6469
public function getFormat() : string
6570
{
66-
return $this->_Format;
71+
return $this->_format;
6772
}
6873

6974
/**
70-
* @param string $Format
75+
* @param string $format
7176
* @return Currency
7277
*/
73-
public function setFormat( string $Format ) : Currency
78+
79+
public function setFormat( string $format ) : Currency
7480
{
75-
$this->_Format = $Format;
81+
$this->_format = $format;
7682
return $this;
7783
}
7884

7985
/**
8086
* @return int
8187
*/
88+
8289
public function getPadLength() : int
8390
{
84-
return $this->_PadLength;
91+
return $this->_padLength;
8592
}
8693

8794
/**
88-
* @param int $PadLength
95+
* @param int $padLength
8996
* @return Currency
9097
*/
91-
public function setPadLength( int $PadLength ) : Currency
98+
99+
public function setPadLength( int $padLength ) : Currency
92100
{
93-
$this->_PadLength = $PadLength;
101+
$this->_padLength = $padLength;
94102
return $this;
95103
}
96104

97105
/**
98-
* @param string $Data
106+
* @param string $data
99107
* @return string|null
100108
*/
101109

102-
public function format( string $Data ): ?string
110+
public function format( string $data ): ?string
103111
{
104112
return
105113
$this->getCurrencySymbol().str_pad(
106114
sprintf(
107115
$this->getFormat(),
108-
round( $Data, 2 )
116+
round( $data, 2 )
109117
),
110118
$this->getPadLength(),
111119
$this->getPadCharacter(),

src/Formatters/Date.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ public function __construct()
1414
}
1515

1616
/**
17-
* @param string $Data
17+
* @param string $data
1818
* @return string|null
1919
*/
2020

21-
public function format( string $Data ): ?string
21+
public function format( string $data ): ?string
2222
{
23-
$Date = self::normalizeDate( $Data );
24-
if( $Date === null )
23+
$date = self::normalizeDate( $data );
24+
if( $date === null )
2525
{
2626
return null;
2727
}
2828

29-
return date( $this->getFormat(), strtotime( $Date ) );
29+
return date( $this->getFormat(), strtotime( $date ) );
3030
}
3131
}

0 commit comments

Comments
 (0)