Skip to content

Commit

Permalink
Documentation (#42)
Browse files Browse the repository at this point in the history
* docs: lion/test v3 documentation added

* docs: lion/files v8 documentation added

* docs: lion/dependency-injection v4 documentation added

* chore: removed file

* docs: lion/security v11 documentation added
  • Loading branch information
Sleon4 authored Dec 1, 2024
1 parent 0f4a5d8 commit 8e7b170
Show file tree
Hide file tree
Showing 7 changed files with 2,614 additions and 49 deletions.
10 changes: 10 additions & 0 deletions src/Tools/Content.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ import v3_LSP from "./Versions/libraries/spreadsheet/v3_LSP";
import v4_LSP from "./Versions/libraries/spreadsheet/v4_LSP";
import v2_LT from "./Versions/libraries/test/v2_LT";
import v3_LDI from "./Versions/libraries/dependency-injection/v3_LDI";
import v3_LT from "./Versions/libraries/test/v3_LT";
import v8_LF from "./Versions/libraries/files/v8_LF";
import v4_LDI from "./Versions/libraries/dependency-injection/v4_LDI";
import v10_LS from "./Versions/libraries/security/v10_LS";
import v11_LS from "./Versions/libraries/security/v11_LS";

export default function Content() {
return {
Expand Down Expand Up @@ -82,6 +87,7 @@ export default function Content() {
"dependency-injection": {
description: "Container for dependency injection with DI-PHP.",
versions: {
v4: v4_LDI(),
v3: v3_LDI(),
v2: v2_LDI(),
v1: v1_LDI(),
Expand All @@ -91,6 +97,7 @@ export default function Content() {
description:
"Library created with the function of working internal system files.",
versions: {
v8: v8_LF(),
v7: v7_LF(),
v6: v6_LF(),
v5: v5_LF(),
Expand Down Expand Up @@ -134,6 +141,8 @@ export default function Content() {
description:
"Library created with the function of implementing AES and RSA Security functions for PHP, it also includes functions to create JWT.",
versions: {
v11: v11_LS(),
v10: v10_LS(),
v9: v9_LS(),
v8: v8_LS(),
v7: v7_LS(),
Expand All @@ -152,6 +161,7 @@ export default function Content() {
description:
"library to implement testing with helpers that allow easy testing with PHPUnit.",
versions: {
v3: v3_LT(),
v2: v2_LT(),
v1: v1_LT(),
},
Expand Down
230 changes: 230 additions & 0 deletions src/Tools/Versions/libraries/dependency-injection/v4_LDI.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
import { Alert } from "react-bootstrap";
import Title from "../../../../pages/components/Title";
import CodeBlock from "../../../../pages/components/CodeBlock";
import Description from "../../../../pages/components/Description";
import { Fragment } from "react";
import LibraryTitle from "../../../../pages/components/LibraryTitle";
import ExampleTitle from "../../../../pages/components/ExampleTitle";
import SupportVersion from "../../../../pages/components/SupportVersion";

export default function v4_LDI() {
return {
"getting-started": {
name: "Getting started",
type: "sub_modules",
list: {
"about-as": {
name: "About us",
code: (
<Fragment>
<Title title={"About us"} />

<Alert variant={"info"}>
<strong>Note: </strong>Currently the library is compatible with
development in Linux environments.
</Alert>

<Description
description={
"About Container for dependency injection with DI-PHP."
}
/>
</Fragment>
),
},
install: {
name: "Install",
code: (
<Fragment>
<Title title={"Install"} />

<Alert variant={"info"}>
<strong>Note: </strong>Currently the library is compatible with
development in Linux environments.
</Alert>

<SupportVersion
title={"Lion-Dependency-Injection"}
version={"8.4"}
/>

<CodeBlock
language={"bash"}
content={"composer require lion/dependency-injection"}
/>
</Fragment>
),
},
},
},
container: {
name: "Container",
type: "sub_modules",
list: {
resolve: {
name: "resolve",
code: (
<Fragment>
<LibraryTitle className={"Container"} methodName={"resolve"} />

<Description
description={
"Resolves a class or dependency from the container."
}
/>

<CodeBlock
language={"php"}
content={`<?php
declare(strict_types=1);
require_once('./vendor/autoload.php');
use App\\Http\\Controllers\\UsersController;
use Lion\\Dependency\\Injection\\Container;
/** @var UsersController $usersController */
$usersController = (new Container())->resolve(UsersController::class);
`}
/>
</Fragment>
),
},
"call-method": {
name: "callMethod",
code: (
<Fragment>
<LibraryTitle className={"Container"} methodName={"callMethod"} />

<Description
description={
"Calls a method on an object with automatic dependency injection."
}
/>

<Fragment>
<ExampleTitle number={1} />

<CodeBlock
language={"php"}
content={`<?php
declare(strict_types=1);
require_once('./vendor/autoload.php');
use App\\Http\\Controllers\\UsersController;
use Lion\\Dependency\\Injection\\Container;
$container = new Container();
/** @var UsersController $usersController */
$usersController = $container->resolve(UsersController::class);
$response = $container->callMethod($usersController, 'createUsers');
var_dump($response);
`}
/>
</Fragment>

<Fragment>
<ExampleTitle number={2} />

<CodeBlock
language={"php"}
content={`<?php
declare(strict_types=1);
require_once('./vendor/autoload.php');
use App\\Http\\Controllers\\UsersController;
use Lion\\Dependency\\Injection\\Container;
$container = new Container();
/** @var UsersController $usersController */
$usersController = $container->resolve(UsersController::class);
$response = $container->callMethod($usersController, 'createUsers', [
'users_name' => 'root',
]);
var_dump($response);
`}
/>
</Fragment>
</Fragment>
),
},
"call-callback": {
name: "callCallback",
code: (
<Fragment>
<LibraryTitle
className={"Container"}
methodName={"callCallback"}
/>

<Description
description={
"Executes a callback with automatic dependency injection."
}
/>

<Fragment>
<ExampleTitle number={1} />

<CodeBlock
language={"php"}
content={`<?php
declare(strict_types=1);
require_once('./vendor/autoload.php');
use App\\Http\\Controllers\\UsersController;
use Lion\\Dependency\\Injection\\Container;
$response = (new Container())
->callCallback(function (UsersController $usersController) {
return $usersController->createUsers();
});
var_dump($response);
`}
/>
</Fragment>

<Fragment>
<ExampleTitle number={2} />

<CodeBlock
language={"php"}
content={`<?php
declare(strict_types=1);
require_once('./vendor/autoload.php');
use App\\Http\\Controllers\\UsersController;
use Lion\\Dependency\\Injection\\Container;
$response = (new Container())
->callCallback(function (UsersController $usersController, string $users_name) {
return $usersController->createUsers($users_name);
}, ['users_name' => 'root']);
var_dump($response);
`}
/>
</Fragment>
</Fragment>
),
},
},
},
};
}
Loading

0 comments on commit 8e7b170

Please sign in to comment.