Skip to content

Commit

Permalink
Merge pull request #78 from philippebeck/dev
Browse files Browse the repository at this point in the history
Release 4.1.0
  • Loading branch information
philippebeck authored Jun 17, 2020
2 parents 833a3f7 + dc1a20b commit 2451c48
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 22 deletions.
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,3 @@ Philippe Beck
Code released under the MIT License

[![GitHub License](https://img.shields.io/github/license/philippebeck/pam.svg?label=License)](https://github.com/philippebeck/pam/blob/master/LICENSE)

---

## Support on Beerpay

Hey dude! Help me out for a couple of :beers:!

[![Beerpay](https://beerpay.io/philippebeck/pam/badge.svg?style=beer-square)](https://beerpay.io/philippebeck/pam) [![Beerpay](https://beerpay.io/philippebeck/pam/make-wish.svg?style=flat-square)](https://beerpay.io/philippebeck/pam?focus=wish)
11 changes: 7 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "philippebeck/pam",
"version": "4.0.0",
"version": "4.1.0",
"type": "library",
"description": "Php Approachable Microframework",
"keywords": [
Expand Down Expand Up @@ -35,11 +35,14 @@
},
"require": {
"php": "^7.3",
"ext-pdo": "*",
"ext-gd": "*",
"ext-exif": "*",
"ext-curl": "*",
"ext-json": "*",
"google/recaptcha": "^1.2.4",
"swiftmailer/swiftmailer": "^6.2.3",
"twig/twig": "^3.0.3",
"ext-gd": "*",
"ext-exif": "*"
"twig/twig": "^3.0.3"
},
"require-dev": {
"tracy/tracy": "^2.7.5"
Expand Down
19 changes: 11 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions core/Controller/Globals/FilesManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ public function setFileExtension()
{
try {
switch ($this->file["type"]) {
case "image/bmp":
return ".bmp";
break;

case "image/gif":
return ".gif";
break;

case "image/jpeg":
return ".jpg";
break;
Expand All @@ -79,8 +87,8 @@ public function setFileExtension()
return ".png";
break;

case "image/gif":
return ".gif";
case "image/webp":
return ".webp";
break;

default:
Expand Down
29 changes: 29 additions & 0 deletions core/Controller/Service/CurlManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Pam\Controller\Service;

/**
* Class CurlManager
* @package Pam\Controller\Service
*/
class CurlManager
{
/**
* @param string $url
* @param string $query
* @param string $key
* @return mixed
*/
public function getApiData(string $url, string $query, string $key = NASA_API)
{
$curl = curl_init("https://" . $url . "?" . $query . "&api_key=" . $key);

curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);

$data = curl_exec($curl);
curl_close($curl);

return json_decode($data, true);
}
}
15 changes: 15 additions & 0 deletions core/Controller/ServiceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Pam\Controller;

use Pam\Controller\Service\ArrayManager;
use Pam\Controller\Service\CurlManager;
use Pam\Controller\Service\ImageManager;
use Pam\Controller\Service\MailManager;
use Pam\Controller\Service\SecurityManager;
Expand All @@ -19,6 +20,11 @@ class ServiceController
*/
private $array = null;

/**
* @var CurlManager
*/
private $curl = null;

/**
* @var ImageManager
*/
Expand All @@ -45,6 +51,7 @@ class ServiceController
public function __construct()
{
$this->array = new ArrayManager();
$this->curl = new CurlManager();
$this->image = new ImageManager();
$this->mail = new MailManager();
$this->security = new SecurityManager();
Expand All @@ -59,6 +66,14 @@ public function getArray(): ArrayManager
return $this->array;
}

/**
* @return CurlManager
*/
public function getCurl(): CurlManager
{
return $this->curl;
}

/**
* @return ImageManager
*/
Expand Down

0 comments on commit 2451c48

Please sign in to comment.