mirror of
https://github.com/antonkomarev/github-profile-views-counter.git
synced 2026-07-30 17:16:17 -04:00
Add CounterRepositoryInterface
This commit is contained in:
@@ -19,11 +19,13 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.4"
|
||||
},
|
||||
"require-dev": {
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Contracts\\Komarev\\GitHubProfileViewsCounter\\": "contracts/",
|
||||
"Komarev\\GitHubProfileViewsCounter\\": "src/"
|
||||
}
|
||||
},
|
||||
|
||||
19
composer.lock
generated
Normal file
19
composer.lock
generated
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "d6dfebb57666653dd233e3ce73e99b17",
|
||||
"packages": [],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "dev",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": true,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": "^7.4"
|
||||
},
|
||||
"platform-dev": []
|
||||
}
|
||||
21
contracts/CounterRepositoryInterface.php
Normal file
21
contracts/CounterRepositoryInterface.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of GitHub Profile Views Counter.
|
||||
*
|
||||
* (c) Anton Komarev <anton@komarev.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Contracts\Komarev\GitHubProfileViewsCounter;
|
||||
|
||||
interface CounterRepositoryInterface
|
||||
{
|
||||
public function getCount(): int;
|
||||
|
||||
public function incrementCount(): void;
|
||||
}
|
||||
@@ -18,8 +18,7 @@ $basePath = realpath(__DIR__ . '/..');
|
||||
$resourcesPath = $basePath . '/resources';
|
||||
$storagePath = $basePath . '/storage';
|
||||
|
||||
require_once $basePath . '/src/CounterImageRendererService.php';
|
||||
require_once $basePath . '/src/CounterFileRepository.php';
|
||||
require $basePath . '/vendor/autoload.php';
|
||||
|
||||
$username = $_GET['username'] ?? '';
|
||||
$username = trim($username);
|
||||
|
||||
@@ -13,7 +13,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace Komarev\GitHubProfileViewsCounter;
|
||||
|
||||
final class CounterFileRepository
|
||||
use Contracts\Komarev\GitHubProfileViewsCounter\CounterRepositoryInterface;
|
||||
|
||||
final class CounterFileRepository implements CounterRepositoryInterface
|
||||
{
|
||||
private string $counterPath;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user