Recommend this page to a friend! |
Download |
Info | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2024-08-05 (2 days ago) | Not yet rated by the users | Total: 11 This week: 11 | All time: 11,364 This week: 7 |
Version | License | PHP version | Categories | |||
php-variable-lifetim 1.0.0 | The PHP License | 8 | Tools, Console, PHP 8 |
Description | Author | |
This package can analyze the use of variables in a PHP script. |
<p align="center"> <img src="https://github.com/DeGraciaMathieu/php-smelly-code-detector/blob/master/arts/robot.png" width="250"> </p>
The lifetime of a variable represents the time a variable exists in a script. It is calculated from the first line to the last line using a given variable.
Favoring variables with a short lifetime can improve code readability and help prevent potential errors. A variable with a long lifetime will likely span from one end of your script to the other, making it difficult to understand. This tool helps monitor the lifetime of your variables and ensures they are placed as close to their usage as possible.
<p align="center"> <img src="/arts/logo.png" width="600"> </p>
This tool is distributed as a PHP Archive (PHAR):
wget https://github.com/DeGraciaMathieu/php-variable-lifetime-analyzer/raw/main/builds/variable-lifetime-analyzer
php variable-lifetime-analyzer --version
php variable-lifetime-analyzer analyze {path}
php variable-lifetime-analyzer analyze app
? PHP Var Lifetime Analyzer ?
117 files found.
392 variables found.
????????????????????????????????????????????????????????????????????????????????????????????
? Average variable lifetime ? Average variable lifetime per method ? Max variable lifetime ?
????????????????????????????????????????????????????????????????????????????????????????????
? 2.18 ? 1.61 ? 22.00 ?
????????????????????????????????????????????????????????????????????????????????????????????
| Options | Description | |-----------------------|-------------| | --json | Output the analysis results in JSON format |
> [!TIP] > Other analysis tools are available.
Files (43) |
File | Role | Description | ||
---|---|---|---|---|
app (5 directories) | ||||
arts (1 file) | ||||
bootstrap (2 files) | ||||
config (2 files) | ||||
tests (3 files, 2 directories) | ||||
.editorconfig | Data | Auxiliary data | ||
box.json | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
composer.lock | Data | Auxiliary data | ||
phpunit.xml.dist | Data | Auxiliary data | ||
README.md | Doc. | Documentation | ||
variable-lifetime-analyzer | Class | Class source |
Files (43) | / | app |
File | Role | Description | ||
---|---|---|---|---|
Application (4 files) | ||||
Domain (5 directories) | ||||
Infrastructure (5 directories) | ||||
Presenter (1 directory) | ||||
Providers (1 file) |
Files (43) | / | app | / | Application |
File | Role | Description |
---|---|---|
AnalyzeAction.php | Class | Class source |
AnalyzeInput.php | Class | Class source |
AnalyzeOutput.php | Class | Class source |
AnalyzeResponse.php | Class | Class source |
Files (43) | / | app | / | Domain |
File | Role | Description | ||
---|---|---|---|---|
Aggregators (2 files) | ||||
DataTransferObjects (1 file) | ||||
Entities (5 files) | ||||
Ports (2 files) | ||||
ValueObjects (2 files) |
Files (43) | / | app | / | Domain | / | Aggregators |
File | Role | Description |
---|---|---|
AnalyzeAggregator.php | Class | Class source |
FileAggregator.php | Class | Class source |
Files (43) | / | app | / | Domain | / | Entities |
File | Role | Description |
---|---|---|
Analyze.php | Class | Class source |
ClassAnalyze.php | Class | Class source |
File.php | Class | Class source |
MethodAnalyze.php | Class | Class source |
NullAnalyze.php | Class | Class source |
Files (43) | / | app | / | Domain | / | Ports |
File | Role | Description |
---|---|---|
AnalyzerService.php | Class | Class source |
FileRepository.php | Class | Class source |
Files (43) | / | app | / | Domain | / | ValueObjects |
File | Role | Description |
---|---|---|
Fqcn.php | Class | Class source |
Variable.php | Class | Class source |
Files (43) | / | app | / | Infrastructure |
File | Role | Description | ||
---|---|---|---|---|
Factories (2 files) | ||||
Helpers (1 file) | ||||
Repositories (1 file) | ||||
Services (1 file) | ||||
Visitors (1 file) |
Files (43) | / | app | / | Infrastructure | / | Factories |
File | Role | Description |
---|---|---|
FileFactory.php | Class | Class source |
VariableFactory.php | Class | Class source |
Files (43) | / | app | / | Infrastructure | / | Repositories |
File | Role | Description |
---|---|---|
FileRepositoryAdapter.php | Class | Class source |
Files (43) | / | app | / | Infrastructure | / | Services |
File | Role | Description |
---|---|---|
AnalyzerServiceAdapter.php | Class | Class source |
Files (43) | / | app | / | Infrastructure | / | Visitors |
File | Role | Description |
---|---|---|
VarLifetimeVisitor.php | Class | Class source |
Files (43) | / | app | / | Presenter | / | Commands |
File | Role | Description |
---|---|---|
AnalyzeCommand.php | Class | Class source |
JsonAnalyzeOutput.php | Class | Class source |
TerminalAnalyzeOutput.php | Class | Class source |
Files (43) | / | bootstrap |
File | Role | Description |
---|---|---|
app.php | Example | Example script |
providers.php | Class | Class source |
Files (43) | / | config |
File | Role | Description |
---|---|---|
app.php | Class | Class source |
commands.php | Class | Class source |
Files (43) | / | tests |
File | Role | Description | ||
---|---|---|---|---|
Feature (1 file) | ||||
Unit (1 file) | ||||
CreatesApplication.php | Class | Class source | ||
Pest.php | Class | Class source | ||
TestCase.php | Class | Class source |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
php-variable-lifetim-2024-08-05.zip 61KB | |
php-variable-lifetim-2024-08-05.tar.gz 52KB | |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.