-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v4 (major update) #7
Conversation
…s-laravel into regular-update
Codecov Report
@@ Coverage Diff @@
## master #7 +/- ##
==========================================
+ Coverage 93.67% 100% +6.32%
+ Complexity 249 111 -138
==========================================
Files 24 16 -8
Lines 411 251 -160
==========================================
- Hits 385 251 -134
+ Misses 26 0 -26
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Только так
$this->code = $code; | ||
$this->name = $name; | ||
|
||
foreach ($areas as $area) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Почему foreach
не заменить на
$this->areas = $areas;
а в CadastralDistricts
сразу не прописать ключи?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because $this->areas
used as index, where key is area code, and value is area object (areas order is not important in this case)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved
$areas = []; | ||
|
||
foreach ($datum['areas'] as $area_info) { | ||
$areas[] = new CadastralArea($area_info['code'], $area_info['name']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Почему не
$areas[$area_info['code']] = new CadastralArea($area_info['code'], $area_info['name']);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Разделение ответственности отсутствие зависимости от порядка (ключей) для CadastralDistrict
в array $areas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved
{ | ||
return (string) Json::encode($this->toArray(), $options); | ||
} | ||
} |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You always can do something like this:
\count($district->getAreas());
keep it simple =)
|
||
// Multiple dots replace with single | ||
return (string) \preg_replace('/\.+/', '.', $value); | ||
} |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
*/ | ||
public function __construct(StaticReferenceInterface $static_reference) | ||
{ | ||
$counter = 0; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be
foreach (\array_values((array) $static_reference->getData(true)) as $key => $datum) {
$this->entities[$key] = new VehicleRegistrationAction($datum['codes'], $datum['description']);
...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не думаю, что здесь это на что-либо влияет (пример @Reallife потребует дополнительный вызов array_values
)
src/ServiceProvider.php
Outdated
} | ||
} | ||
$this->app->singleton(CadastralDistricts::class, static function (): CadastralDistricts { | ||
return new References\CadastralDistricts(StaticReferencesData::cadastralDistricts()); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нет, по запаре
parent::setUp(); | ||
|
||
/** @var m\MockInterface|StaticReferenceInterface $static_reference */ | ||
$static_reference = m::mock(StaticReferenceInterface::class) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- выносить в абстракт 2 строчки?
- какие данные и из каких пропертей?
Description
Changed
illuminate\*
packages version now is^5.5
illuminate\*
packages version now is~6.0
References\ReferenceInterface
now extendsIteratorAggregate, Countable, Illuminate\Contracts\Support\Arrayable
and not contains any methodshas*
methods (indexes used)Added
References\CadastralDistricts
References\SubjectCodes
References\VehicleCategories
References\VehicleFineArticles
References\VehicleRegistrationActions
References\VehicleRepairMethods
References\VehicleTypes
References\Entities\EntityInterface
(extendsIlluminate\Contracts\Support\Support\Arrayable
)References\Entities\CadastralArea
References\Entities\CadastralDistrict
References\Entities\SubjectCodesInfo
References\Entities\VehicleCategory
References\Entities\VehicleFineArticle
References\Entities\VehicleRegistrationAction
References\Entities\VehicleRepairMethod
References\Entities\VehicleType
Removed
AutoCategoriesFacade
,AutoFinesFacade
,AutoRegionsFacade
,CadastralRegionsFacade
,RegistrationActionsFacade
,RepairMethodsFacade
)References\AbstractReference
References\AbstractReferenceEntry
References\AutoCategories\AutoCategories
References\AutoCategories\AutoCategoryEntry
References\AutoFines\AutoFineEntry
References\AutoFines\AutoFines
References\AutoRegions\AutoRegionEntry
References\AutoRegions\AutoRegions
References\CadastralDistricts\CadastralDistrictEntry
References\CadastralDistricts\CadastralDistricts
References\CadastralDistricts\CadastralRegionEntry
References\CadastralDistricts\CadastralRegions
References\RegistrationActions\RegistrationActionEntry
References\RegistrationActions\RegistrationActions
References\RepairMethods\RepairMethods
References\RepairMethods\RepairMethodsEntry
References\ReferenceEntryInterface
References\Traits\TransliterateTrait
Checklist