Skip to content

Commit 8f237c4

Browse files
committed
Apply coding standards
1 parent 07016ee commit 8f237c4

28 files changed

Lines changed: 2219 additions & 2252 deletions

.php-cs-fixer.dist.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
->exclude('build')
1414
->append([__FILE__]);
1515

16-
$overrides = [];
16+
$overrides = [
17+
// Many tests need to be rewritten to support assertSame instead of assertEquals
18+
'php_unit_strict' => false,
19+
];
1720

1821
$options = [
1922
'finder' => $finder,

src/Config/Relations.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
<?php namespace Tatter\Relations\Config;
1+
<?php
2+
3+
namespace Tatter\Relations\Config;
24

35
use CodeIgniter\Config\BaseConfig;
46

57
class Relations extends BaseConfig
68
{
7-
// Whether to continue instead of throwing exceptions
8-
public $silent = true;
9-
10-
// Whether related items can load their own relations
11-
public $allowNesting = true;
12-
13-
// Return type to fall back to if no model is available
14-
public $defaultReturnType = 'object';
9+
// Whether to continue instead of throwing exceptions
10+
public $silent = true;
11+
12+
// Whether related items can load their own relations
13+
public $allowNesting = true;
14+
15+
// Return type to fall back to if no model is available
16+
public $defaultReturnType = 'object';
1517
}
Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
1-
<?php namespace Tatter\Relations\Exceptions;
1+
<?php
2+
3+
namespace Tatter\Relations\Exceptions;
24

3-
use RuntimeException;
45
use CodeIgniter\Exceptions\ExceptionInterface;
5-
use CodeIgniter\Exceptions\FrameworkException;
6+
use RuntimeException;
67

78
class RelationsException extends RuntimeException implements ExceptionInterface
89
{
9-
public static function forUnknownTable($tableName)
10-
{
11-
return new static(lang('Relations.unknownTable', [$tableName]));
12-
}
13-
14-
public static function forUnknownRelation($table1, $table2)
15-
{
16-
return new static(lang('Relations.unknownRelation', [$table1, $table2]));
17-
}
18-
19-
public static function forMissingPivots($table1, $table2)
20-
{
21-
return new static(lang('Relations.missingPivots', [$table1, $table2]));
22-
}
23-
24-
public static function forMissingProperty($class, $property)
25-
{
26-
return new static(lang('Relations.missingProperty', [$class, $property]));
27-
}
28-
29-
public static function forNotRelatable($class)
30-
{
31-
return new static(lang('Relations.notRelatable', [$class]));
32-
}
10+
public static function forUnknownTable($tableName)
11+
{
12+
return new static(lang('Relations.unknownTable', [$tableName]));
13+
}
14+
15+
public static function forUnknownRelation($table1, $table2)
16+
{
17+
return new static(lang('Relations.unknownRelation', [$table1, $table2]));
18+
}
19+
20+
public static function forMissingPivots($table1, $table2)
21+
{
22+
return new static(lang('Relations.missingPivots', [$table1, $table2]));
23+
}
24+
25+
public static function forMissingProperty($class, $property)
26+
{
27+
return new static(lang('Relations.missingProperty', [$class, $property]));
28+
}
29+
30+
public static function forNotRelatable($class)
31+
{
32+
return new static(lang('Relations.notRelatable', [$class]));
33+
}
3334
}

src/Language/en/Relations.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
namespace Tatter\Relations\Language\en;
44

55
return [
6-
'noSchemas' => 'Unable to load Schemas library!',
7-
'invalidWithout' => '"Without" parameter must be a table name or array of names',
8-
'unknownTable' => 'Table not present in schema: {0}',
9-
'unknownRelation' => 'Table {0} is not known to be related to {1}',
10-
'missingPivots' => 'Table {0} does not indicate a pivot route to {1}',
11-
'missingProperty' => 'Class {0} must have the {1} property to use relations',
12-
'notRelatable' => 'Class {0} must implement RelatableInterface to use relations',
13-
'invalidOperation' => 'Operation {0} not valid on {1}',
6+
'noSchemas' => 'Unable to load Schemas library!',
7+
'invalidWithout' => '"Without" parameter must be a table name or array of names',
8+
'unknownTable' => 'Table not present in schema: {0}',
9+
'unknownRelation' => 'Table {0} is not known to be related to {1}',
10+
'missingPivots' => 'Table {0} does not indicate a pivot route to {1}',
11+
'missingProperty' => 'Class {0} must have the {1} property to use relations',
12+
'notRelatable' => 'Class {0} must implement RelatableInterface to use relations',
13+
'invalidOperation' => 'Operation {0} not valid on {1}',
1414
];

0 commit comments

Comments
 (0)