Skip to content
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

Merged
merged 2 commits into from
Feb 19, 2018
Merged

Refactor namespace #8

merged 2 commits into from
Feb 19, 2018

Conversation

LauLaman
Copy link
Collaborator

@LauLaman LauLaman commented Feb 16, 2018

Get Rid of the authentication code: implement in guzzle config
Refactor namespace

@LauLaman LauLaman added the enhancement New feature or request label Feb 16, 2018
@LauLaman LauLaman self-assigned this Feb 16, 2018
@LauLaman LauLaman requested a review from batusa February 16, 2018 13:52
@LauLaman LauLaman changed the title Kaf refactor namespace Refactor namespace Feb 16, 2018
@LauLaman LauLaman force-pushed the KAF_REFACTOR_NAMESPACE branch 7 times, most recently from 72f7ecf to 677d39c Compare February 19, 2018 08:48
Copy link

@batusa batusa left a 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
Copy link

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
Copy link

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;
Copy link

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.


final class ProfileResponse implements ResponseInterface
final class KvkPaginator implements KvkPaginatorInterface
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

* @param $json
* @return mixed
*/
private function decodeJsonToArray($json)
Copy link

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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe shouldThrowExceptionWhenItemsAreNotFound?

Copy link
Collaborator Author

@LauLaman LauLaman Feb 19, 2018

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.

Copy link

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();
Copy link

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();
Copy link

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();
Copy link

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);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variable name ☝️

@LauLaman LauLaman merged commit dd963e2 into master Feb 19, 2018
@LauLaman LauLaman deleted the KAF_REFACTOR_NAMESPACE branch February 19, 2018 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

2 participants