Skip to content

Commit

Permalink
code fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ateliee committed Dec 14, 2019
1 parent 2dae36a commit c988986
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 55 deletions.
1 change: 0 additions & 1 deletion .coveralls.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
service_name: travis-pro
repo_token: 6LgnNXDDHVZ6PMADr5ZB6yzXH9I6cKT7U
coverage_clover: logs/clover.xml
json_path: logs/coveralls-upload.json
exclude_no_stmt: true
18 changes: 3 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# PlantUML parser for PHP

[![Build Status](https://travis-ci.org/ateliee/plantuml-parser.svg?branch=development)](https://travis-ci.org/ateliee/plantuml-parser)
[![Coverage Status](https://coveralls.io/repos/github/ateliee/plantuml-parser/badge.svg?branch=%28HEAD+detached+at+75dabae%29)](https://coveralls.io/github/ateliee/plantuml-parser?branch=%28HEAD+detached+at+75dabae%29)
[![Build Status](https://travis-ci.com/ateliee/plantuml-parser.svg?branch=master)](https://travis-ci.com/ateliee/plantuml-parser)
[![Coverage Status](https://coveralls.io/repos/github/ateliee/plantuml-parser/badge.svg?branch=master)](https://coveralls.io/github/ateliee/plantuml-parser?branch=master)
[![Latest Stable Version](https://poser.pugx.org/ateliee/plantuml-parser/v/stable)](https://packagist.org/packages/ateliee/plantuml-parser)
[![Total Downloads](https://poser.pugx.org/ateliee/plantuml-parser/downloads)](https://packagist.org/packages/ateliee/plantuml-parser)
![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)

[PlantUML](http://plantuml.com/ja/)の書き込み・読み込みができるものがなかったので作成。

Expand Down Expand Up @@ -156,18 +156,6 @@ customer |o-ri-o{ order
@enduml
```

## コードチェック
CodeSnifferを利用

```
# レポート出力
composer report
# 自動修正
composer convert
```



## 参考
* [Plant UML](http://plantuml.com/ja/)
* [Real World PlantUML](https://real-world-plantuml.com/)
17 changes: 15 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"email": "info@ateliee.com"
}
],
"keywords": ["PlantUML", "AsciiDoc"],
"keywords": [
"PlantUML",
"AsciiDoc"
],
"type": "library",
"license": "MIT",
"require": {
Expand All @@ -24,6 +27,7 @@
"scripts": {
"test": "phpunit",
"check": "php vendor/bin/phpcs --standard=phpcs.xml",
"lint": "php vendor/bin/phpcs --standard=phpcs.xml",
"report": "php vendor/bin/phpcs -sq --no-colors --report-diff=./logs/report-diff.log --report-full=./logs/report-full.log --standard=phpcs.xml",
"convert": "php vendor/bin/phpcbf --standard=phpcs.xml"
},
Expand All @@ -37,5 +41,14 @@
"Ateliee\\": "src/",
"Ateliee\\Tests\\": "tests/"
}
},
"extra": {
"hooks": {
"pre-commit": [
"echo committing as $(git config user.name)",
"composer test",
"composer report"
]
}
}
}
}
15 changes: 0 additions & 15 deletions example/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,6 @@

use Ateliee\PlantUMLParser\PUMLParser;


$parser = new PUMLParser();
$uml = $parser->loadFile(__DIR__.'/test.puml');
$parser->save(__DIR__.'/test.puml', $uml);
//
//
//$uml = "@startuml
//Alice -> Bob: Authentication Request
//Bob --> Alice: Authentication Response
//
//Alice -> Bob: Another authentication Request
//Alice <-- Bob: another authentication Response
//@enduml";
//$parser = new PUMLParser();
//
//$result = $parser->parse($uml);
//
//var_dump($parser->output($result));
2 changes: 1 addition & 1 deletion example/sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@
);

$plant_uml = new PUMLParser();
$plant_uml->save(__DIR__.'/test.puml', $uml);
$plant_uml->save(__DIR__.'/test.puml', $uml);
2 changes: 1 addition & 1 deletion example/save.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,4 @@

$parser = new PUMLParser();
$parser->save(__DIR__.'/test.puml', $uml);
var_dump($parser->output($uml));
var_dump($parser->output($uml));
2 changes: 2 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

<!-- 対象フォルダ -->
<file>./src</file>
<file>./example</file>
<file>./tests</file>

<!-- 除外したいファイル、ディレクトリ -->
<exclude-pattern>*/database/*</exclude-pattern>
Expand Down
7 changes: 4 additions & 3 deletions tests/Assert/PUMLBaseTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
namespace Ateliee\Tests;

use Ateliee\PlantUMLParser\PUMLElementList;
use Ateliee\PlantUMLParser\PUMLParser;

Expand All @@ -21,8 +22,8 @@ class PUMLAssert extends \PHPUnit_Framework_Assert
*
* @param string $uml
*/
public static function assertEncodeDecode($uml){

public static function assertEncodeDecode($uml)
{
$parser = new PUMLParser();

$result = $parser->loadString($uml);
Expand All @@ -37,4 +38,4 @@ public static function assertEncodeDecode($uml){
$parser->output($result)
);
}
}
}
9 changes: 5 additions & 4 deletions tests/PUMLElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
use Ateliee\PlantUMLParser\PUMLParser;
use Ateliee\PlantUMLParser\PUMLStr;

class PUMLElementTest extends \PHPUnit_Framework_TestCase {

class PUMLElementTest extends \PHPUnit_Framework_TestCase
{
public function testList()
{
$uml = new PUMLElementList();
Expand Down Expand Up @@ -99,8 +99,9 @@ public function testElementBlock()
* @test
* @expectedException Ateliee\PlantUMLParser\Exception\InvalidParamaterException
*/
public function testInvalidParamaterException(){
public function testInvalidParamaterException()
{
$uml = new PUMLElementList();
$uml->add('test');
}
}
}
6 changes: 3 additions & 3 deletions tests/PUMLParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
use Ateliee\PlantUMLParser\PUMLElementList;
use Ateliee\PlantUMLParser\PUMLParser;

class PUMLParserTest extends \PHPUnit_Framework_TestCase {

class PUMLParserTest extends \PHPUnit_Framework_TestCase
{
public function testParamaters()
{
$parser = new PUMLParser();
$uml = new PUMLElementList();

$this->assertContainsOnly('string', [$parser->output($uml)]);
}
}
}
27 changes: 17 additions & 10 deletions tests/Parser/PUMLReadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use Ateliee\PlantUMLParser\PUMLParser;
use Ateliee\Tests\PUMLAssert;

class PUMLReadTest extends \PHPUnit_Framework_TestCase {

class PUMLReadTest extends \PHPUnit_Framework_TestCase
{
/**
* シーケンス図の正常系テスト
*
Expand Down Expand Up @@ -75,7 +75,8 @@ public function testEncode()
* @test
* @expectedException Ateliee\PlantUMLParser\Exception\FileOpenException
*/
public function testFileOpenException(){
public function testFileOpenException()
{

$parser = new PUMLParser();
$parser->loadFile(null);
Expand All @@ -85,7 +86,8 @@ public function testFileOpenException(){
* @test
* @expectedException Ateliee\PlantUMLParser\Exception\FileOpenException
*/
public function testFileOpenException2(){
public function testFileOpenException2()
{

$parser = new PUMLParser();
$parser->loadFile(__DIR__.'/a');
Expand All @@ -95,7 +97,8 @@ public function testFileOpenException2(){
* @test
* @expectedException Ateliee\PlantUMLParser\Exception\InvalidParamaterException
*/
public function testInvalidParamaterException(){
public function testInvalidParamaterException()
{

$parser = new PUMLParser();
$parser->loadString(null);
Expand All @@ -106,7 +109,8 @@ public function testInvalidParamaterException(){
* @test
* @expectedException Ateliee\PlantUMLParser\Exception\SyntaxException
*/
public function testSyntaxException(){
public function testSyntaxException()
{

$parser = new PUMLParser();
$parser->loadString("@startuml
Expand All @@ -119,7 +123,8 @@ public function testSyntaxException(){
* @test
* @expectedException Ateliee\PlantUMLParser\Exception\SyntaxException
*/
public function testSyntaxException2(){
public function testSyntaxException2()
{

$parser = new PUMLParser();
$parser->loadString("@startuml
Expand All @@ -129,7 +134,8 @@ public function testSyntaxException2(){
* @test
* @expectedException Ateliee\PlantUMLParser\Exception\SyntaxException
*/
public function testSyntaxException3(){
public function testSyntaxException3()
{

$parser = new PUMLParser();
$parser->loadString("@enduml");
Expand All @@ -138,10 +144,11 @@ public function testSyntaxException3(){
* @test
* @expectedException Ateliee\PlantUMLParser\Exception\SyntaxException
*/
public function testSyntaxException4(){
public function testSyntaxException4()
{

$parser = new PUMLParser();
$parser->loadString("@enduml
aaaaa");
}
}
}

0 comments on commit c988986

Please sign in to comment.