Skip to content

Commit

Permalink
rename to GemLibrary
Browse files Browse the repository at this point in the history
  • Loading branch information
roboxon committed Oct 26, 2023
1 parent 9cae3a8 commit f2f2f93
Show file tree
Hide file tree
Showing 26 changed files with 69 additions and 64 deletions.
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
"license": "MIT",
"autoload": {
"psr-4": {
"Gemvc\\": "src/",
"Gemvc\\Database\\": "src/database/",
"Gemvc\\Email\\": "src/email/",
"Gemvc\\Helper\\": "src/helper/",
"Gemvc\\Http\\Request\\": "src/http/request/",
"Gemvc\\http\\Response\\": "src/http/response/"
"GemLibrary\\": "src/",
"GemLibrary\\Database\\": "src/database/",
"GemLibrary\\DBQuery\\": "src/database/query/",
"GemLibrary\\Email\\": "src/email/",
"GemLibrary\\Helper\\": "src/helper/",
"GemLibrary\\Http\\": "src/http/request/"
}
},
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion src/database/PdoConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* with this source code in the file LICENSE.
*/

namespace Gemvc\Database;
namespace GemLibrary\Database;

use PDO;

Expand Down
2 changes: 1 addition & 1 deletion src/database/PdoQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* with this source code in the file LICENSE.
*/

namespace Gemvc\Database;
namespace GemLibrary\Database;

class PdoQuery
{
Expand Down
10 changes: 5 additions & 5 deletions src/database/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
* with this source code in the file LICENSE.
*/

namespace Gemvc\Database;
namespace GemLibrary\Database;

use Gemvc\Database\Query\Delete;
use Gemvc\Database\Query\Insert;
use Gemvc\Database\Query\Select;
use Gemvc\Database\Query\Update;
use GemLibrary\DBQuery\Delete;
use GemLibrary\DBQuery\Insert;
use GemLibrary\DBQuery\Select;
use GemLibrary\DBQuery\Update;

class QueryBuilder
{
Expand Down
2 changes: 1 addition & 1 deletion src/database/QueryBuilderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* with this source code in the file LICENSE.
*/

namespace Gemvc\Database;
namespace GemLibrary\Database;

interface QueryBuilderInterface
{
Expand Down
10 changes: 5 additions & 5 deletions src/database/query/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
* with this source code in the file LICENSE.
*/

namespace Gemvc\Database\Query;
namespace GemLibrary\DBQuery;

use GemLibrary\Database\PdoQuery as DatabasePdoQuery;
use GemLibrary\Database\QueryBuilderInterface;

use Gemvc\Database\PdoQuery;
use Gemvc\Database\QueryBuilderInterface;
use Gemvc\Database\QueryProvider;

class Delete implements QueryBuilderInterface
{
Expand Down Expand Up @@ -50,7 +50,7 @@ public function __toString(): string
return $this->_query;
}

public function run(PdoQuery $queryProvider): self
public function run(DatabasePdoQuery $queryProvider): self
{
$this->result = $queryProvider->deleteQuery($this->_query, $this->arrayBindValues);

Expand Down
8 changes: 4 additions & 4 deletions src/database/query/Insert.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
* with this source code in the file LICENSE.
*/

namespace Gemvc\Database\Query;
namespace GemLibrary\DBQuery;

use Gemvc\Database\PdoQuery;
use Gemvc\Database\QueryBuilderInterface;
use Gemvc\Database\QueryProvider;
use GemLibrary\Database\PdoQuery;
use GemLibrary\Database\QueryBuilderInterface;
use GemLibrary\Database\QueryProvider;

class Insert implements QueryBuilderInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/database/query/LimitTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* with this source code in the file LICENSE.
*/

namespace Gemvc\Database\Query;
namespace GemLibrary\DBQuery;

trait LimitTrait
{
Expand Down
8 changes: 4 additions & 4 deletions src/database/query/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
* with this source code in the file LICENSE.
*/

namespace Gemvc\Database\Query;
namespace GemLibrary\DBQuery;

use Gemvc\Database\PdoQuery;
use Gemvc\Database\QueryBuilderInterface;
use Gemvc\Database\QueryProvider;
use GemLibrary\Database\PdoQuery;
use GemLibrary\Database\QueryBuilderInterface;
use GemLibrary\Database\QueryProvider;

class Select implements QueryBuilderInterface
{
Expand Down
8 changes: 4 additions & 4 deletions src/database/query/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
* with this source code in the file LICENSE.
*/

namespace Gemvc\Database\Query;
namespace GemLibrary\DBQuery;

use Gemvc\Database\PdoQuery;
use Gemvc\Database\QueryBuilderInterface;
use Gemvc\Database\QueryProvider;
use GemLibrary\Database\PdoQuery;
use GemLibrary\Database\QueryBuilderInterface;
use GemLibrary\Database\QueryProvider;

class Update implements QueryBuilderInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/database/query/WhereTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* with this source code in the file LICENSE.
*/

namespace Gemvc\Database\Query;
namespace GemLibrary\DBQuery;

trait WhereTrait
{
Expand Down
2 changes: 1 addition & 1 deletion src/email/GemSMTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* with this source code in the file LICENSE.
*/

namespace Gemvc\Email;
namespace GemLibrary\Email;

use Gemvc\Helper\WebHelper;
use PHPMailer\PHPMailer\PHPMailer;
Expand Down
2 changes: 1 addition & 1 deletion src/helper/ChatGptClient.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Gemvc\Helper;
namespace GemLibrary\Helper;

require 'vendor/autoload.php';

Expand Down
19 changes: 13 additions & 6 deletions src/helper/CryptHelper.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Gemvc\Helper;
namespace GemLibrary\Helper;

class CryptoHelper {

Expand All @@ -18,23 +18,30 @@ public static function passwordVerify(string $passwordToCheck, string $hash): bo
* @param string $secret
* @param string $iv
* @param string $action
* @param string $encrypt_algorythem
* @return false|string
* action = d decrypt , default action = encrypt
* this function work based on 'sha256'
* @algorythem default 'AES-256-CBC'
*/
public static function crypt(string $string, string $secret, string $iv, string $action = 'e'): false|string
public static function crypt(string $string, string $secret, string $iv, string $action = 'e', string $encrypt_algorythem = null): false|string
{
if(!$encrypt_algorythem)
{
$encrypt_algorythem = 'AES-256-CBC';
}
$output = false;
$key = hash(SHA_ALGORYTHEM, $secret);
$iv = substr(hash(SHA_ALGORYTHEM, $iv), 0, 16);
$key = hash('sha256', $secret);
$iv = substr(hash('sha256', $iv), 0, 16);
if ('e' === $action) {
$encrypted = openssl_encrypt($string, ENCRYPTION_ALGORYTHEM, $key, 0, $iv);
$encrypted = openssl_encrypt($string, $encrypt_algorythem, $key, 0, $iv);
if ($encrypted) {
$output = base64_encode($encrypted);
}
} elseif ('d' === $action) {
$bse64Decode = base64_decode($string, true);
if (\is_string($bse64Decode) && '' !== $bse64Decode) {
$output = openssl_decrypt($bse64Decode, ENCRYPTION_ALGORYTHEM, $key, 0, $iv);
$output = openssl_decrypt($bse64Decode, $encrypt_algorythem, $key, 0, $iv);
}
}
return $output;
Expand Down
7 changes: 3 additions & 4 deletions src/helper/FileHelper.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
<?php

namespace Gemvc\Helper;
namespace GemLibrary\Helper;

class FileHelper
{
public string $sourceFile;
public string $outputFile;
public ?string $error = null;
public ?string $secret;
public function __construct(string $sourceFile, string $outputFile = null, bool $dontUseDefaultFileRoot = null)
public function __construct(string $sourceFile, string $outputFile = null)
{
$this->error = null;
$this->sourceFile = $dontUseDefaultFileRoot ? $sourceFile : FILE_ROOT . $sourceFile;
$this->sourceFile = $sourceFile;
$outputFile = $outputFile ? $outputFile : $sourceFile;
$this->outputFile = $dontUseDefaultFileRoot ? $outputFile : FILE_ROOT . $outputFile;
if ($this->isDestinationDirectoryExists()) {
if (!file_exists($this->sourceFile)) { {
$this->error = "Source-file not found $this->sourceFile";
Expand Down
2 changes: 1 addition & 1 deletion src/helper/ImageHelper.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Gemvc\Helper;
namespace GemLibrary\Helper;

use GdImage;

Expand Down
2 changes: 1 addition & 1 deletion src/helper/JsonHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* with this source code in the file LICENSE.
*/

namespace Gemvc\Helper;
namespace GemLibrary\Helper;

class JsonHelper
{
Expand Down
2 changes: 1 addition & 1 deletion src/helper/NoCors.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* with this source code in the file LICENSE.
*/

namespace Gemvc\Helper;
namespace GemLibrary\Helper;

class NoCors
{
Expand Down
2 changes: 1 addition & 1 deletion src/helper/StringHelper.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Gemvc\Helper;
namespace GemLibrary\Helper;

class StringHelper
{
Expand Down
2 changes: 1 addition & 1 deletion src/helper/TypeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* with this source code in the file LICENSE.
*/

namespace Gemvc\Helper;
namespace GemLibrary\Helper;

class TypeHelper
{
Expand Down
2 changes: 1 addition & 1 deletion src/helper/WebHelper.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Gemvc\Helper;
namespace GemLibrary\Helper;
class WebHelper{

/**
Expand Down
9 changes: 4 additions & 5 deletions src/http/ApacheRequest.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<?php

namespace Gemvc\Http;
namespace GemLibrary\Http;

use Gemvc\Helper\StringHelper;
use Gemvc\Helper\TypeHelper;
use Gemvc\Http\GemRequest;
use GemLibrary\Helper\StringHelper;
use GemLibrary\Http\GemRequest as HttpGemRequest;

class ApacheRequest
{
public GemRequest $request;
public HttpGemRequest $request;

public function __construct()
{
Expand Down
4 changes: 2 additions & 2 deletions src/http/GemRequest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

namespace Gemvc\Http;
use Gemvc\Helper\TypeHelper;
namespace GemLibrary\Http;
use GemLibrary\Helper\TypeHelper;

class GemRequest
{
Expand Down
4 changes: 2 additions & 2 deletions src/http/GemToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
* with this source code in the file LICENSE.
*/

namespace Gemvc\Http;
namespace GemLibrary\Http;

use Firebase\JWT\JWT;
use Firebase\JWT\Key;
use Gemvc\Helper\TypeHelper;
use GemLibrary\Helper\TypeHelper;

class GemToken
{
Expand Down
2 changes: 1 addition & 1 deletion src/http/JsonResponse.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Gemvc\Http;
namespace GemLibrary\Http;

class JsonResponse
{
Expand Down
6 changes: 3 additions & 3 deletions src/http/SwooleRequest.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace Gemvc\Http;
namespace GemLibrary\Http;

use Gemvc\Helper\StringHelper;
use Gemvc\Http\GemRequest;
use GemLibrary\Helper\StringHelper;
use GemLibrary\Http\GemRequest;

class SwooleRequest
{
Expand Down

0 comments on commit f2f2f93

Please sign in to comment.