-
Notifications
You must be signed in to change notification settings - Fork 8
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
Refactor namespace #8
Conversation
72f7ecf
to
677d39c
Compare
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.
just some small remarks, after that I think we're good to go!
|
||
abstract class AbstractBuilder | ||
abstract class AbstractFactory |
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.
the Factory
name becomes a better fit since we were not working the Builder
pattern.
} | ||
|
||
public function fromData(array $data): ProfileResponse | ||
public function fromProfileData(array $data): KvkPaginator |
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.
maybe use KvkPaginatorInterface
as return type instead.
|
||
interface KvkPaginatorFactoryInterface | ||
{ | ||
public function fromProfileData(array $data): KvkPaginator; |
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.
same here for the return type.
src/Client/KvkPaginator.php
Outdated
|
||
final class ProfileResponse implements ResponseInterface | ||
final class KvkPaginator implements KvkPaginatorInterface |
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.
👍
src/KvkClient.php
Outdated
* @param $json | ||
* @return mixed | ||
*/ | ||
private function decodeJsonToArray($json) |
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.
type hint string
as parameter type and then we can get rid of this docblock. the return type should be an array.
* @dataProvider getNonExistingKvkNumbers | ||
* @expectedException \Werkspot\KvkApi\Http\Adapter\Guzzle\Exception\NotFoundException | ||
*/ | ||
public function getProfile_shouldThrowException(int $kvkNumber): void |
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.
maybe shouldThrowExceptionWhenItemsAreNotFound
?
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.
I this case I think having a more explicit way is better since we are moving away from the happy flow. I think the WhenItemsAreNotFound
is not necessary since the data provider already tells us that these items are nonExisting. so we should expect an exception.
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.
I see what you mean. I usually would not rely on the dataProvider to be explicit, the first place I look is at the method name.
{ | ||
/** | ||
* @test | ||
* @dataProvider getArrayData | ||
*/ | ||
public function fromArray(array $data): void | ||
{ | ||
$builder = new BusinessActivityBuilder(); | ||
$Factory = new BusinessActivityFactory(); |
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.
start variable name with lowercase letter.
{ | ||
/** | ||
* @test | ||
* @dataProvider getAddressData | ||
*/ | ||
public function fromArray(array $data): void | ||
{ | ||
$builder = new AddressBuilder(); | ||
$Factory = new AddressFactory(); |
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.
start variable name with lowercase letter.
{ | ||
/** | ||
* @test | ||
* @dataProvider getArrayData | ||
*/ | ||
public function fromArray(array $data): void | ||
{ | ||
$builder = new TradeNamesBuilder(); | ||
$output = $builder->fromArray($data); | ||
$Factory = new TradeNamesFactory(); |
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.
same here
|
||
$builder = new CompanyBuilder($tradeNamesBuilder, $businessActivityBuilder, $addressBuilder); | ||
$Factory = new CompanyFactory($tradeNamesFactory, $businessActivityFactory, $addressFactory); |
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.
variable name ☝️
677d39c
to
ab38bab
Compare
Get Rid of the authentication code: implement in guzzle config
Refactor namespace