Skip to content

Commit dad87da

Browse files
committed
Init project
0 parents  commit dad87da

76 files changed

Lines changed: 7907 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Composer dependencies
2+
/vendor/
3+
/composer.lock
4+
5+
# PHPUnit
6+
.phpunit.result.cache
7+
8+
# PHP CS Fixer
9+
/.php-cs-fixer.cache
10+
11+
# Editor directories and files
12+
/.idea
13+
/.vscode
14+
*.sublime-project
15+
*.sublime-workspace
16+
17+
# Operating system files
18+
.DS_Store
19+
Thumbs.db
20+
21+
# Local environment files
22+
/.env
23+
/.env.backup
24+
/.env.local
25+
26+
# PHP CodeSniffer
27+
/.phpcs.xml
28+
/.phpcs.xml.dist
29+
/phpcs.xml
30+
/phpcs.xml.dist
31+
32+
# PHPStan
33+
/phpstan.neon
34+
/phpstan.neon.dist
35+
36+
# Local development tools
37+
/.php_cs
38+
/.php_cs.cache
39+
/.php_cs.dist
40+
/_ide_helper.php
41+
42+
# Build artifacts
43+
/.build/
44+
/coverage/
45+
46+
# PHPUnit coverage reports
47+
/clover.xml
48+
/coverage.xml
49+
/coverage/
50+
51+
# Laravel generated files
52+
bootstrap/cache/
53+
.phpunit.result.cache
54+
55+
# Local Composer dependencies
56+
composer.phar
57+
58+
workbench
59+
playground
60+
61+
# Log files
62+
*.log
63+
64+
# Cache files
65+
cache
66+
runtime
67+
68+
.context

.php-cs-fixer.dist.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
require_once 'vendor/autoload.php';
6+
7+
return \Spiral\CodeStyle\Builder::create()
8+
->include(__DIR__ . '/src')
9+
->include(__DIR__ . '/tests')
10+
->include(__FILE__)
11+
->build();

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Kyrian Obikwelu
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Research module for CTX

composer.json

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"name": "ctx/module-research",
3+
"description": "Research module for CTX framework",
4+
"keywords": [],
5+
"type": "library",
6+
"license": "MIT",
7+
"authors": [
8+
{
9+
"name": "Pavel Buchnev",
10+
"email": "butschster@gmail.com"
11+
}
12+
],
13+
"require": {
14+
"php": ">=8.3",
15+
"cocur/slugify": "^4.6",
16+
"spiral/boot": "^3.15",
17+
"spiral/config": "^3.15",
18+
"spiral/console": "^3.15",
19+
"spiral/files": "^3.15",
20+
"spiral/json-schema-generator": "^2.1"
21+
},
22+
"require-dev": {
23+
"spiral/code-style": "^2.2",
24+
"phpunit/phpunit": "^10.5",
25+
"rector/rector": "^2.1",
26+
"vimeo/psalm": "^6.0"
27+
},
28+
"autoload": {
29+
"psr-4": {
30+
"Butschster\\ContextGenerator\\Research\\": "src/"
31+
}
32+
},
33+
"autoload-dev": {
34+
"psr-4": {
35+
"Tests\\": "tests"
36+
}
37+
},
38+
"scripts": {
39+
"cs-check": "vendor/bin/php-cs-fixer fix --dry-run",
40+
"cs-fix": "vendor/bin/php-cs-fixer fix",
41+
"psalm": "vendor/bin/psalm --config=psalm.xml ./src",
42+
"psalm:ci": "vendor/bin/psalm --config=psalm.xml ./src --output-format=github --shepherd --show-info=false --stats --threads=4 --no-cache",
43+
"refactor": "rector process --config=rector.php",
44+
"refactor:ci": "rector process --config=rector.php --dry-run --ansi",
45+
"test": "vendor/bin/phpunit",
46+
"test:cc": [
47+
"@putenv XDEBUG_MODE=coverage",
48+
"phpunit --coverage-clover=.build/phpunit/logs/clover.xml --color=always"
49+
],
50+
"cs:fix": [
51+
"@cs-fix",
52+
"@refactor"
53+
],
54+
"lint": [
55+
"@cs-check",
56+
"@refactor:ci",
57+
"@psalm",
58+
"@test"
59+
]
60+
},
61+
"config": {
62+
"sort-packages": true
63+
},
64+
"minimum-stability": "dev",
65+
"prefer-stable": true
66+
}

phpunit.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
>
7+
<testsuites>
8+
<testsuite name="Test Suite">
9+
<directory suffix="Test.php">./tests</directory>
10+
</testsuite>
11+
</testsuites>
12+
<source>
13+
<include>
14+
<directory>src</directory>
15+
</include>
16+
</source>
17+
</phpunit>

psalm.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0"?>
2+
<psalm
3+
errorLevel="4"
4+
resolveFromConfigFile="true"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xmlns="https://getpsalm.org/schema/config"
7+
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
8+
findUnusedBaselineEntry="true"
9+
findUnusedCode="false"
10+
findUnusedVariablesAndParams="true"
11+
ensureOverrideAttribute="false"
12+
>
13+
<projectFiles>
14+
<directory name="src"/>
15+
<ignoreFiles>
16+
<directory name="vendor"/>
17+
<directory name="tests"/>
18+
</ignoreFiles>
19+
</projectFiles>
20+
</psalm>

rector.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector;
7+
use Rector\Set\ValueObject\LevelSetList;
8+
use Rector\Set\ValueObject\SetList;
9+
10+
return static function (RectorConfig $rectorConfig): void {
11+
$rectorConfig->paths([
12+
__DIR__ . '/src',
13+
__DIR__ . '/tests',
14+
]);
15+
16+
// Register rules for PHP 8.4 migration
17+
$rectorConfig->sets([
18+
SetList::PHP_83,
19+
LevelSetList::UP_TO_PHP_83,
20+
]);
21+
22+
// Skip vendor directories
23+
$rectorConfig->skip([
24+
__DIR__ . '/vendor',
25+
AddOverrideAttributeToOverriddenMethodsRector::class,
26+
]);
27+
};

src/Config/ResearchConfig.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Butschster\ContextGenerator\Research\Config;
6+
7+
use Spiral\Core\InjectableConfig;
8+
9+
final class ResearchConfig extends InjectableConfig implements ResearchConfigInterface
10+
{
11+
public const string CONFIG = 'research';
12+
13+
protected array $config = [
14+
'enabled' => true,
15+
'templates_path' => '.templates',
16+
'researches_path' => '.researches',
17+
'storage_driver' => 'markdown',
18+
'default_entry_status' => 'draft',
19+
'env_config' => [],
20+
];
21+
22+
public function getTemplatesPath(): string
23+
{
24+
return (string) $this->config['templates_path'];
25+
}
26+
27+
public function getResearchesPath(): string
28+
{
29+
return (string) $this->config['researches_path'];
30+
}
31+
32+
public function getStorageDriver(): string
33+
{
34+
return (string) $this->config['storage_driver'];
35+
}
36+
37+
public function getDefaultEntryStatus(): string
38+
{
39+
return (string) $this->config['default_entry_status'];
40+
}
41+
42+
public function getEnvConfig(): array
43+
{
44+
return (array) $this->config['env_config'];
45+
}
46+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Butschster\ContextGenerator\Research\Config;
6+
7+
interface ResearchConfigInterface
8+
{
9+
/**
10+
* Get templates directory path
11+
*/
12+
public function getTemplatesPath(): string;
13+
14+
/**
15+
* Get researches base directory path
16+
*/
17+
public function getResearchesPath(): string;
18+
19+
/**
20+
* Get storage driver name
21+
*/
22+
public function getStorageDriver(): string;
23+
24+
/**
25+
* Get default status for new entries
26+
*/
27+
public function getDefaultEntryStatus(): string;
28+
29+
/**
30+
* Get environment variable configuration
31+
*/
32+
public function getEnvConfig(): array;
33+
}

0 commit comments

Comments
 (0)