-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
Showing
7 changed files
with
2,614 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
230 changes: 230 additions & 0 deletions
230
src/Tools/Versions/libraries/dependency-injection/v4_LDI.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
), | ||
}, | ||
}, | ||
}, | ||
}; | ||
} |
Oops, something went wrong.