phpcpd
is a Copy/Paste Detector (CPD) for PHP code.
- PHP version 8.3 or later
Download the latest version here and put phar archive into your project.
Note: This tool is distributed as a PHP Archive (PHAR).
$ php phpcpd.phar --fuzzy --verbose src tests
8.0.0
Found 1 code clones with 17 duplicated lines in 1 files:
- /var/www/html/tests/Application/ApiKey/Transport/Controller/Api/v1/ApiKeyControllerTest.php:128-145 (17 lines)
/var/www/html/tests/Application/ApiKey/Transport/Controller/Api/v1/ApiKeyControllerTest.php:153-170
public function testThatFindOneActionForRootUserReturnsSuccessResponse(): void
{
$client = $this->getTestClient('john-root', 'password-root');
$resource = static::getContainer()->get(ApiKeyResource::class);
$apiKeyEntity = $resource->findOneBy([
'description' => 'ApiKey Description: api',
]);
self::assertInstanceOf(ApiKey::class, $apiKeyEntity);
$client->request('GET', static::$baseUrl . '/' . $apiKeyEntity->getId());
$response = $client->getResponse();
$content = $response->getContent();
self::assertNotFalse($content);
self::assertSame(Response::HTTP_OK, $response->getStatusCode(), "Response:\n" . $response);
$responseData = JSON::decode($content, true);
$this->checkBasicFieldsInResponse($responseData);
0.05% duplicated lines out of 31339 total lines of code.
Average code clone size is 17 lines, the largest code clone has 17 lines
Time: 00:00.100, Memory: 10.00 MB
- Docker Engine version 18.06 or later
- Docker Compose version 1.22 or later
- An editor or IDE
Note: OS recommendation - Linux Ubuntu based.
- PHP 8.4 fpm
- Composer 2
- Phive 0.15
- Phing 3.0
For installing Docker Engine with docker compose please follow steps mentioned on page Docker Engine.
Note 1: Please run next cmd after above step if you are using Linux OS: sudo usermod -aG docker $USER
Note 2: If you are using Docker Desktop for MacOS 12.2 or later - please enable virtiofs for performance (enabled by default since Docker Desktop v4.22).
1.Clone this repository from GitHub.
2.Edit and set XDEBUG_CONFIG=
inside .env
file (optional, by default XDEBUG_CONFIG=main
).
3.Configure /docker/dev/xdebug-main.ini
(Linux/Windows) or /docker/dev/xdebug-osx.ini
(MacOS) (optional).
4.Build, start and install the docker images from your terminal:
make build
make start
make setup
After application will start (make start
) and in order to get shell access inside php container you can run following command:
make ssh
Note: Please use exit
command in order to return from container's shell to local shell.
In case you edited Dockerfile or other environment configuration you'll need to build container again using next commands:
make down
make build
make start
Please use next make commands in order to start and stop environment:
make start
make stop
Please use next make commands in order to stop and remove environment containers, networks:
make down
make build
make start
make stop
make down
make restart
make ssh
make ssh-root
make setup
make update
make composer-audit
make info
make help
make phar
make signed-phar
make phpunit
make phpcs
make ecs
make ecs-fix
make phpstan
make logs
etc....
Notes: Please see more commands in Makefile
- cli-parser
- version
- php-file-iterator
- php-timer
- phpunit
- composer-bin-plugin
- security-advisories
- easy-coding-standard
- phpstan
- php-coveralls
- For new feature development, fork
develop
branch into a new branch with one of the two patterns:feature/{ticketNo}
- Commit often, and write descriptive commit messages, so it's easier to follow steps taken when reviewing.
- Push this branch to the repo and create pull request into
develop
to get feedback, with the formatfeature/{ticketNo}
- "Short descriptive title of Jira task". - Iterate as needed.
- Make sure that "All checks have passed" on CircleCI(or another one in case you are not using CircleCI) and status is green.
- When PR is approved, it will be squashed & merged, into
develop
and later merged intorelease/{No}
for deployment.
Note: You can find git flow detail example here.