Skip to content

Commit b5cff21

Browse files
committed
first commit
0 parents  commit b5cff21

File tree

22 files changed

+5745
-0
lines changed

22 files changed

+5745
-0
lines changed

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
###> defaults ###
2+
/.env.local
3+
/.env.local.php
4+
/.env.*.local
5+
/var/
6+
/vendor/
7+
###< defaults ###
8+
9+
###> ide ###
10+
/.idea
11+
###< ide ###
12+
13+
###> friendsofphp/php-cs-fixer ###
14+
/.php-cs-fixer.php
15+
/.php-cs-fixer.cache
16+
###< friendsofphp/php-cs-fixer ###
17+

.php-cs-fixer.dist.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
$finder = (new PhpCsFixer\Finder())
4+
->in(__DIR__)
5+
->exclude('var')
6+
;
7+
8+
return (new PhpCsFixer\Config())
9+
->setRules([
10+
'@PSR12' => true,
11+
])
12+
->setFinder($finder)
13+
->setHideProgress(true)
14+
;

CHANGELOG.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7+
8+
## Releases
9+
10+
### [0.1.0] - 2022-12-18
11+
12+
* Initial release
13+
* Add src
14+
* Add tests
15+
* PHP Coding Standards Fixer
16+
* PHPMND - PHP Magic Number Detector
17+
* PHPStan - PHP Static Analysis Tool
18+
* PHPUnit - The PHP Testing Framework
19+
* Rector - Instant Upgrades and Automated Refactoring
20+
* Add README.md
21+
* Add LICENSE.md
22+
23+
## Add new version
24+
25+
```bash
26+
# Checkout master branch
27+
$ git checkout main && git pull
28+
29+
# Check current version
30+
$ vendor/bin/version-manager --current
31+
32+
# Increase patch version
33+
$ vendor/bin/version-manager --patch
34+
35+
# Change changelog
36+
$ vi CHANGELOG.md
37+
38+
# Push new version
39+
$ git add CHANGELOG.md VERSION && git commit -m "Add version $(cat VERSION)" && git push
40+
41+
# Tag and push new version
42+
$ git tag -a "$(cat VERSION)" -m "Version $(cat VERSION)" && git push origin "$(cat VERSION)"
43+
```

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Björn Hempel <bjoern@hempel.li>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# PHP Timezone
2+
3+
This library converts different timezone strings.
4+
5+
## Installation
6+
7+
```bash
8+
composer require ixnode/php-timezone
9+
```
10+
11+
```bash
12+
vendor/bin/php-timezone -V
13+
```
14+
15+
```bash
16+
php-timezone 0.1.0 (12-19-2022 01:17:26) - Björn Hempel <bjoern@hempel.li>
17+
```
18+
19+
## Usage
20+
21+
```php
22+
use Ixnode\PhpTimezone\Timezone;
23+
```
24+
25+
```php
26+
$sizeHumanReadable = (new Timezone($timezone))->getCountryCode();
27+
```
28+
29+
## Development
30+
31+
```bash
32+
git clone git@github.com:ixnode/php-timezone.git && cd php-timezone
33+
```
34+
35+
```bash
36+
composer install
37+
```
38+
39+
```bash
40+
composer test
41+
```
42+
43+
## License
44+
45+
This tool is licensed under the MIT License - see the [LICENSE](/LICENSE) file for details

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1.0

bin/header/dbinit

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
# ------------
4+
# This script prints the header for TEST-DB - Initialization
5+
#
6+
# @author Björn Hempel <bjoern@hempel.li>
7+
# @version 0.1.0 (2022-12-18)
8+
# ------------
9+
10+
HEADER="TEST-DB - Initialization"
11+
COMMAND="$1"
12+
DESCRIPTION="$2"
13+
14+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
15+
16+
eval "$SCRIPT_DIR/global \"$HEADER\" \"$COMMAND\" \"$DESCRIPTION\" \"$DESCRIPTION\""
17+
RETURN_CODE=$?
18+
19+
exit $RETURN_CODE
20+

bin/header/error

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
# ------------
4+
# This script prints an error message
5+
#
6+
# @author Björn Hempel <bjoern@hempel.li>
7+
# @version 0.1.0 (2022-12-18)
8+
# ------------
9+
10+
HEADER="Error - At least one test is failed (-_-) "
11+
12+
START_COLOR='\e[48;2;224;108;117m\e[38;2;9;16;22m'
13+
END_COLOR='\e[0m'
14+
15+
printf "\n"
16+
printf "%b┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐%b\n" "$START_COLOR" "$END_COLOR"
17+
printf "%b│ │%b\n" "$START_COLOR" "$END_COLOR"
18+
printf "%b│ %-116s │%b\n" "$START_COLOR" ">>> $HEADER <<<" "$END_COLOR"
19+
printf "%b│ │%b\n" "$START_COLOR" "$END_COLOR"
20+
printf "%b└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘%b\n" "$START_COLOR" "$END_COLOR"
21+
printf "\n"
22+

bin/header/global

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/usr/bin/env bash
2+
3+
# ------------
4+
# This script prints the base header for given string
5+
#
6+
# @author Björn Hempel <bjoern@hempel.li>
7+
# @version 0.1.0 (2022-12-18)
8+
# ------------
9+
10+
HEADER=$1
11+
COMMAND="$2"
12+
DESCRIPTION="$3"
13+
14+
[ "$DESCRIPTION" != "" ] && HEADER="$HEADER ($DESCRIPTION)"
15+
16+
# ------------
17+
# Checks if a given application exists
18+
#
19+
# @author Björn Hempel
20+
# @version 1.0
21+
# ------------
22+
function application_exists()
23+
{
24+
`which $1 >/dev/null`
25+
}
26+
27+
# ------------
28+
# Returns the current time in milliseconds.
29+
#
30+
# @author Björn Hempel
31+
# @version 1.0
32+
# ------------
33+
function get_time()
34+
{
35+
# Use mac gdate
36+
if application_exists 'gdate'; then
37+
echo $(gdate +%s%3N)
38+
return 0
39+
fi
40+
41+
# In bash 5.0 we do have $EPOCHREALTIME
42+
if [ ! -z ${EPOCHREALTIME} ]; then
43+
printf "%.3f" ${EPOCHREALTIME} | tr -d '.' | tr -d ','
44+
return 0
45+
fi
46+
47+
# Last option to use date (this works not correctly on a mac).
48+
echo $(($(date +'%s * 1000 + %-N / 1000000')))
49+
}
50+
51+
START_COLOR='\e[48;2;97;175;239m\e[38;2;9;16;22m'
52+
END_COLOR='\e[0m'
53+
54+
printf "\n"
55+
printf "%b┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐%b\n" "$START_COLOR" "$END_COLOR"
56+
printf "%b│ │%b\n" "$START_COLOR" "$END_COLOR"
57+
printf "%b│ %-116s │%b\n" "$START_COLOR" ">>> $HEADER <<<" "$END_COLOR"
58+
printf "%b│ │%b\n" "$START_COLOR" "$END_COLOR"
59+
printf "%b└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘%b\n" "$START_COLOR" "$END_COLOR"
60+
printf "\n"
61+
62+
START_TIME=$(get_time)
63+
64+
eval "$COMMAND"
65+
RETURN_CODE=$?
66+
67+
END_TIME=$(get_time)
68+
69+
ELAPSED=$((END_TIME-START_TIME))
70+
71+
printf "\n"
72+
printf " Time taken: %d ms\n" "$ELAPSED"
73+
printf "\n"
74+
printf "\n"
75+
76+
exit $RETURN_CODE
77+

bin/header/ixno

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
# ------------
4+
# This script prints the rsm header
5+
#
6+
# @author Björn Hempel <bjoern@hempel.li>
7+
# @version 0.1.0 (2022-12-18)
8+
# ------------
9+
10+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
11+
VERSION_PATH="$SCRIPT_DIR/../../VERSION"
12+
VERSION=$(cat $VERSION_PATH)
13+
14+
HEADER1="PHPNamingConventions (PNC)"
15+
HEADER2="Version: $VERSION"
16+
HEADER3="Copyright (c) 2022 björn hempel <bjoern@hempel.li>"
17+
18+
echo
19+
printf " ┌───┐ ┌───┐ ┌───┐ ┌───┐ "
20+
printf "$HEADER1"
21+
echo
22+
printf " │ I │ │ X │ │ N │ │ O │ "
23+
printf "$HEADER2"
24+
echo
25+
printf " └───┘ └───┘ └───┘ └───┘ "
26+
printf "$HEADER3"
27+
echo
28+
echo
29+
echo

0 commit comments

Comments
 (0)