Skip to content

Commit

Permalink
Rework code structure, improve code quality (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
rougin authored Sep 29, 2024
1 parent 857d9bd commit efcb94b
Show file tree
Hide file tree
Showing 121 changed files with 4,023 additions and 4,615 deletions.
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
.php-cs-fixer.cache
.phpintel
.phpunit.result.cache
bower_components
build
combustor.bak
combustor.yml
composer.lock
docs
node_modules
tests/Fixture/Sample/controllers
tests/Fixture/Sample/models
tests/Fixture/Sample/views
vendor
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

All notable changes to `Combustor` will be documented in this file.

## [1.3.0](https://github.com/rougin/transcribe/compare/v1.2.4...v1.3.0) - Unreleased

### Changed
- Minimum version of PHP to `v5.3.0`
- Code documentation by `php-cs-fixer`, code quality by `phpstan`
- Workflow from `Travis CI` to `Github Actions`
- Code coverage from `Scrutinizer CI` to `Codecov`

### Removed
- `CONTRIBUTING.md`

## [1.2.4](https://github.com/rougin/combustor/compare/v1.2.3...v1.2.4) - 2018-04-18

### Fixed
Expand Down
22 changes: 0 additions & 22 deletions CONDUCT.md

This file was deleted.

29 changes: 0 additions & 29 deletions CONTRIBUTING.md

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Rougin Gutib
Copyright (c) Rougin Gutib

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
21 changes: 19 additions & 2 deletions bin/combustor
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
#!/usr/bin/env php
<?php

// Load and run the Combustor application
require 'combustor.php';
use Rougin\Combustor\Console;

// Return the root directory of the project ------------
$vendor = (string) __DIR__ . '/../../../../';

$exists = file_exists($vendor . '/vendor/autoload.php');

$root = $exists ? $vendor : __DIR__ . '/../';
// -----------------------------------------------------

// Load the Composer autoloader -------
require $root . '/vendor/autoload.php';
// ------------------------------------

$app = new Console($root);

// Run the console application ---
$app->run();
// -------------------------------
50 changes: 0 additions & 50 deletions bin/combustor.php

This file was deleted.

14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
],
"require":
{
"php": ">=5.4.0",
"rougin/blueprint": "~0.1",
"rougin/describe": "~1.4",
"rougin/spark-plug": "~0.4"
"php": ">=5.3.0",
"rougin/blueprint": "dev-master",
"rougin/classidy": "dev-master",
"rougin/describe": "dev-master",
"rougin/spark-plug": "dev-master"
},
"require-dev":
{
Expand All @@ -28,8 +29,7 @@
},
"bin":
[
"bin/combustor",
"bin/combustor.php"
"bin/combustor"
],
"autoload":
{
Expand Down Expand Up @@ -60,7 +60,7 @@
{
"rougin/codeigniter": "Codeigniter 3's Composer-based package.",
"rougin/credo": "A Doctrine ORM wrapper for Codeigniter 3.",
"rougin/ignite": "A Codeigniter 3 project based on Composer.",
"rougin/ignite": "A Composer-based Codeigniter 3 project.",
"rougin/refinery": "\"Ready-to-eat\" migrations for Codeigniter 3.",
"rougin/wildfire": "A Query Builder wrapper for Codeigniter 3."
}
Expand Down
14 changes: 10 additions & 4 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ parameters:
- tests
excludePaths:
analyse:
- tests/Weblog/application/views
- tests/Fixture/Plates
- tests/Fixture/Sample/controllers
- tests/Fixture/Sample/models
- tests/Fixture/Sample/views
scanDirectories:
- vendor/rougin/codeigniter/src
ignoreErrors:
- '#^Call to an undefined method Rougin\\Wildfire\\Wildfire\:\:test\(\)\.$#'
- '#^Access to an undefined property CI_Controller\:\:\$db\.$#'
- '#^Access to an undefined property CI_Controller\:\:\$user\.$#'
- '#^Access to property \$database on an unknown class CI_DB\.$#'
- '#^Access to property \$dbdriver on an unknown class CI_DB\.$#'
- '#^Access to property \$dsn on an unknown class CI_DB\.$#'
- '#^Access to property \$hostname on an unknown class CI_DB\.$#'
- '#^Access to property \$password on an unknown class CI_DB\.$#'
- '#^Access to property \$username on an unknown class CI_DB\.$#'
- '#^Constant APPPATH not found\.$#'
- '#^Constant ENVIRONMENT not found\.$#'
89 changes: 89 additions & 0 deletions src/Combustor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?php

namespace Rougin\Combustor;

use Rougin\Describe\Driver\DriverInterface;
use Rougin\SparkPlug\Controller;

/**
* @package Combustor
*
* @author Rougin Gutib <rougingutib@gmail.com>
*/
class Combustor
{
/**
* @var \Rougin\SparkPlug\Controller|null
*/
protected $app = null;

/**
* @var \Rougin\Describe\Driver\DriverInterface|null
*/
protected $driver = null;

/**
* @var string
*/
protected $root;

/**
* @param string $root
*/
public function __construct($root)
{
$this->root = $root;
}

/**
* @return string
*/
public function getAppPath()
{
$app = $this->root . '/application';

$root = $this->getRootPath();

return is_dir($app) ? $app : $root;
}

/**
* @return \Rougin\Describe\Driver\DriverInterface|null
*/
public function getDriver()
{
return $this->driver;
}

/**
* @return string
*/
public function getRootPath()
{
return $this->root;
}

/**
* @param \Rougin\SparkPlug\Controller $app
*
* @return self
*/
public function setApp(Controller $app)
{
$this->app = $app;

return $this;
}

/**
* @param \Rougin\Describe\Driver\DriverInterface $driver
*
* @return self
*/
public function setDriver(DriverInterface $driver)
{
$this->driver = $driver;

return $this;
}
}
Loading

0 comments on commit efcb94b

Please sign in to comment.