Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
shimomo committed Jan 2, 2025
0 parents commit e88a198
Show file tree
Hide file tree
Showing 19 changed files with 1,712 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
35 changes: 35 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: tests
on:
push:
branches:
- main
schedule:
- cron: '0 0 * * *'
jobs:
tests:
name: tests
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.1', '8.2', '8.3', '8.4']
steps:
- name: Setup php ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
- name: Checkout
uses: actions/checkout@v4
- name: Validate composer.json
run: composer validate
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run test suites
run: |
mkdir --parents build/logs
vendor/bin/phpunit --coverage-clover=build/logs/clover.xml
- name: Upload coverage results
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require php-coveralls/php-coveralls
php-coveralls --coverage_clover=build/logs/clover.xml -v
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/vendor
.phpunit.result.cache
composer.lock
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) 2020 shimomo

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.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Boatrace Sakura Converter

[![Build Status](https://github.com/boatrace-sakura/converter/workflows/tests/badge.svg)](https://github.com/boatrace-sakura/converter/actions?query=workflow%3Atests)
[![Coverage Status](https://coveralls.io/repos/github/boatrace-sakura/converter/badge.svg?branch=main)](https://coveralls.io/github/boatrace-sakura/converter?branch=main)
[![Latest Stable Version](https://poser.pugx.org/boatrace-sakura/converter/v/stable)](https://packagist.org/packages/boatrace-sakura/converter)
[![Latest Unstable Version](https://poser.pugx.org/boatrace-sakura/converter/v/unstable)](https://packagist.org/packages/boatrace-sakura/converter)
[![License](https://poser.pugx.org/boatrace-sakura/converter/license)](https://packagist.org/packages/boatrace-sakura/converter)

## Installation
```bash
composer require boatrace-sakura/converter
```

## Usage
```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Boatrace\Sakura\Converter;

var_dump(Converter::convertToTechniqueId('逃げ')); // int(1)
var_dump(Converter::convertToTechniqueId('差し')); // int(2)
var_dump(Converter::convertToTechniqueId('まくり')); // int(3)
var_dump(Converter::convertToTechniqueId('まくり差し')); // int(4)
var_dump(Converter::convertToTechniqueId('抜き')); // int(5)
var_dump(Converter::convertToTechniqueId('恵まれ')); // int(6)

var_dump(Converter::convertToTechniqueName(1)); // string(6) "逃げ"
var_dump(Converter::convertToTechniqueName(2)); // string(6) "差し"
var_dump(Converter::convertToTechniqueName(3)); // string(9) "まくり"
var_dump(Converter::convertToTechniqueName(4)); // string(15) "まくり差し"
var_dump(Converter::convertToTechniqueName(5)); // string(6) "抜き"
var_dump(Converter::convertToTechniqueName(6)); // string(9) "恵まれ"
```

## License
The Boatrace Sakura Converter is open source software licensed under the [MIT license](LICENSE).
31 changes: 31 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "boatrace-sakura/converter",
"description": "The Boatrace Sakura Converter.",
"license": "MIT",
"type": "library",
"authors": [
{
"name": "shimomo",
"email": "developer@shimomo.net"
}
],
"require": {
"php": "^8.1",
"boatrace-sakura/trimmer": "^1.0",
"nesbot/carbon": "^2.0 || ^3.0",
"php-di/php-di": "^6.0 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^9.0"
},
"autoload": {
"psr-4": {
"Boatrace\\Sakura\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Boatrace\\Sakura\\Tests\\": "tests/"
}
}
}
10 changes: 10 additions & 0 deletions config/classes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

return [
['id' => 1, 'name' => 'A1'],
['id' => 2, 'name' => 'A2'],
['id' => 3, 'name' => 'B1'],
['id' => 4, 'name' => 'B2'],
];
12 changes: 12 additions & 0 deletions config/definitions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

return [
'Converter' => \DI\create('\Boatrace\Sakura\Converter')->constructor(
\DI\get('MainConverter')
),
'MainConverter' => function ($container) {
return $container->get('\Boatrace\Sakura\MainConverter');
},
];
22 changes: 22 additions & 0 deletions config/places.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

return [
['id' => 1, 'name' => '1'],
['id' => 2, 'name' => '2'],
['id' => 3, 'name' => '3'],
['id' => 4, 'name' => '4'],
['id' => 5, 'name' => '5'],
['id' => 6, 'name' => '6'],
['id' => 7, 'name' => ''],
['id' => 8, 'name' => ''],
['id' => 9, 'name' => ''],
['id' => 10, 'name' => ''],
['id' => 11, 'name' => ''],
['id' => 12, 'name' => ''],
['id' => 13, 'name' => ''],
['id' => 14, 'name' => 'F'],
['id' => 15, 'name' => 'L'],
['id' => 16, 'name' => ''],
];
53 changes: 53 additions & 0 deletions config/prefectures.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

declare(strict_types=1);

return [
['id' => 1, 'name' => '北海道'],
['id' => 2, 'name' => '青森'],
['id' => 3, 'name' => '岩手'],
['id' => 4, 'name' => '宮城'],
['id' => 5, 'name' => '秋田'],
['id' => 6, 'name' => '山形'],
['id' => 7, 'name' => '福島'],
['id' => 8, 'name' => '茨城'],
['id' => 9, 'name' => '栃木'],
['id' => 10, 'name' => '群馬'],
['id' => 11, 'name' => '埼玉'],
['id' => 12, 'name' => '千葉'],
['id' => 13, 'name' => '東京'],
['id' => 14, 'name' => '神奈川'],
['id' => 15, 'name' => '新潟'],
['id' => 16, 'name' => '富山'],
['id' => 17, 'name' => '石川'],
['id' => 18, 'name' => '福井'],
['id' => 19, 'name' => '山梨'],
['id' => 20, 'name' => '長野'],
['id' => 21, 'name' => '岐阜'],
['id' => 22, 'name' => '静岡'],
['id' => 23, 'name' => '愛知'],
['id' => 24, 'name' => '三重'],
['id' => 25, 'name' => '滋賀'],
['id' => 26, 'name' => '京都'],
['id' => 27, 'name' => '大阪'],
['id' => 28, 'name' => '兵庫'],
['id' => 29, 'name' => '奈良'],
['id' => 30, 'name' => '和歌山'],
['id' => 31, 'name' => '鳥取'],
['id' => 32, 'name' => '島根'],
['id' => 33, 'name' => '岡山'],
['id' => 34, 'name' => '広島'],
['id' => 35, 'name' => '山口'],
['id' => 36, 'name' => '徳島'],
['id' => 37, 'name' => '香川'],
['id' => 38, 'name' => '愛媛'],
['id' => 39, 'name' => '高知'],
['id' => 40, 'name' => '福岡'],
['id' => 41, 'name' => '佐賀'],
['id' => 42, 'name' => '長崎'],
['id' => 43, 'name' => '熊本'],
['id' => 44, 'name' => '大分'],
['id' => 45, 'name' => '宮崎'],
['id' => 46, 'name' => '鹿児島'],
['id' => 47, 'name' => '沖縄'],
];
30 changes: 30 additions & 0 deletions config/stadiums.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);

return [
['id' => 1, 'name' => '桐生'],
['id' => 2, 'name' => '戸田'],
['id' => 3, 'name' => '江戸川'],
['id' => 4, 'name' => '平和島'],
['id' => 5, 'name' => '多摩川'],
['id' => 6, 'name' => '浜名湖'],
['id' => 7, 'name' => '蒲郡'],
['id' => 8, 'name' => '常滑'],
['id' => 9, 'name' => ''],
['id' => 10, 'name' => '三国'],
['id' => 11, 'name' => 'びわこ'],
['id' => 12, 'name' => '住之江'],
['id' => 13, 'name' => '尼崎'],
['id' => 14, 'name' => '鳴門'],
['id' => 15, 'name' => '丸亀'],
['id' => 16, 'name' => '児島'],
['id' => 17, 'name' => '宮島'],
['id' => 18, 'name' => '徳山'],
['id' => 19, 'name' => '下関'],
['id' => 20, 'name' => '若松'],
['id' => 21, 'name' => '芦屋'],
['id' => 22, 'name' => '福岡'],
['id' => 23, 'name' => '唐津'],
['id' => 24, 'name' => '大村'],
];
12 changes: 12 additions & 0 deletions config/techniques.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

return [
['id' => 1, 'name' => '逃げ'],
['id' => 2, 'name' => '差し'],
['id' => 3, 'name' => 'まくり'],
['id' => 4, 'name' => 'まくり差し'],
['id' => 5, 'name' => '抜き'],
['id' => 6, 'name' => '恵まれ'],
];
11 changes: 11 additions & 0 deletions config/weathers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

return [
['id' => 1, 'name' => ''],
['id' => 2, 'name' => '曇り'],
['id' => 3, 'name' => ''],
['id' => 4, 'name' => ''],
['id' => 5, 'name' => ''],
];
23 changes: 23 additions & 0 deletions config/windDirections.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

return [
['id' => 1, 'name' => ''],
['id' => 2, 'name' => ''],
['id' => 3, 'name' => ''],
['id' => 4, 'name' => ''],
['id' => 5, 'name' => ''],
['id' => 6, 'name' => ''],
['id' => 7, 'name' => ''],
['id' => 8, 'name' => ''],
['id' => 9, 'name' => ''],
['id' => 10, 'name' => ''],
['id' => 11, 'name' => ''],
['id' => 12, 'name' => ''],
['id' => 13, 'name' => ''],
['id' => 14, 'name' => ''],
['id' => 15, 'name' => ''],
['id' => 16, 'name' => ''],
['id' => 17, 'name' => ''],
];
26 changes: 26 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">

<testsuites>
<testsuite name="boatrace-sakura">
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>./src</directory>
</whitelist>
</filter>

<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
</phpunit>
Loading

0 comments on commit e88a198

Please sign in to comment.