Skip to content

Commit 736089e

Browse files
committed
match php versions; use Url helper; use container where possible
1 parent c0e0ecf commit 736089e

File tree

5 files changed

+17
-38
lines changed

5 files changed

+17
-38
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@
4040
"source": "https://github.com/sms77io/concrete5"
4141
},
4242
"type": "concrete5-package",
43-
"version": "2.1.0"
43+
"version": "2.2.0"
4444
}

controller.php

+9-17
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
final class Controller extends Package {
1414
/** @var string $MIN_PHP_VERSION */
15-
private $MIN_PHP_VERSION = '7.3.0';
15+
private $MIN_PHP_VERSION = '5.6.0';
1616

1717
/** @var string $appVersionRequired */
1818
protected $appVersionRequired = '8.5.2';
@@ -26,19 +26,15 @@ final class Controller extends Package {
2626
protected $pkgHandle = 'sms77';
2727

2828
/** @var string $pkgVersion */
29-
protected $pkgVersion = '2.1.0';
29+
protected $pkgVersion = '2.2.0';
3030

31-
/**
32-
* @return mixed
33-
*/
31+
/** @return string */
3432
public function getPackageDescription() {
3533
return t('Send SMS via Sms77.');
3634
}
3735

38-
/**
39-
* @return string
40-
*/
41-
public function getPackageName(){
36+
/** @return string */
37+
public function getPackageName() {
4238
return t('Sms77');
4339
}
4440

@@ -74,16 +70,12 @@ private function commonTasks(PackageEntity $pkg) {
7470
}
7571
}
7672

77-
/**
78-
* @throws Exception
79-
*/
80-
public function install(){
73+
/** @throws Exception */
74+
public function install() {
8175
$this->commonTasks(parent::install());
8276
}
8377

84-
/**
85-
* @throws Exception
86-
*/
78+
/** @throws Exception */
8779
public function upgrade() {
8880
parent::upgrade();
8981

@@ -97,7 +89,7 @@ public function uninstall() {
9789
parent::uninstall();
9890

9991
/** @var Connection $db */
100-
$db = \Database::connection();
92+
$db = $this->app->make('database/connection');
10193
$db->createQueryBuilder()->delete('Config')
10294
->where('configNamespace = :namespace')
10395
->setParameters([':namespace' => $this->pkgHandle])->execute();

controllers/single_page/dashboard/sms77.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
defined('C5_EXECUTE') or die('Access Denied.');
44

5+
use Concrete\Core\Support\Facade\Url;
56
use Sms77\Concrete5\AbstractSinglePageDashboardController;
67
use Sms77\Concrete5\Options;
78
use Sms77\Concrete5\Routes;
@@ -24,7 +25,7 @@ public function submit(){
2425
$msg = t('Settings updated!');
2526
}
2627

27-
$to = Routes::getAbsoluteURL(Routes::$DASHBOARD);
28+
$to = Url::to(Routes::$DASHBOARD);
2829
if ('' !== $msg) $to .= "?message=$msg";
2930

3031
$this->redirect($to);

src/AbstractMessageController.php

+5-10
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Concrete\Core\Http\Client\Client;
66
use Concrete\Core\Page\Page;
7+
use Concrete\Core\Support\Facade\Url;
78
use Concrete\Core\User\Group\Group;
89
use Concrete\Core\User\Group\GroupList;
910
use Concrete\Core\User\UserInfo;
@@ -55,9 +56,7 @@ public function submit() {
5556
$this->view();
5657
}
5758

58-
/**
59-
* @return array
60-
*/
59+
/** @return array */
6160
protected function buildRecipients() {
6261
$to = [];
6362

@@ -76,9 +75,7 @@ protected function buildRecipients() {
7675
return $to;
7776
}
7877

79-
/**
80-
* @return string
81-
*/
78+
/** @return string */
8279
protected function getText() {
8380
$text = $this->post('text', '');
8481

@@ -109,7 +106,7 @@ public function on_start() {
109106
/** @return void */
110107
public function view() {
111108
if (!$this->client) {
112-
$this->set('dashboardLink', Routes::getAbsoluteURL(Routes::$DASHBOARD));
109+
$this->set('dashboardLink', URL::to(Routes::$DASHBOARD));
113110
}
114111

115112
$this->set('group', $this->post('group', self::$ALL_GROUPS_ID));
@@ -161,9 +158,7 @@ private function initClient() {
161158
$this->client = new ApiClient($client, $this->apiKey);
162159
}
163160

164-
/**
165-
* @param $msg
166-
*/
161+
/** @param string|array|null $msg */
167162
protected function setMessage($msg) {
168163
$this->set('message', isset($msg)
169164
? is_array($msg) ? implode(PHP_EOL, $msg) : $msg

src/Routes.php

-9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
defined('C5_EXECUTE') or die('Access Denied.');
44

5-
use Concrete\Core\Page\Page;
65
use ReflectionClass;
76

87
abstract class Routes {
@@ -21,12 +20,4 @@ abstract class Routes {
2120
public static function all(){
2221
return (new ReflectionClass(static::class))->getStaticProperties();
2322
}
24-
25-
/**
26-
* @param string $route
27-
* @return string
28-
*/
29-
public static function getAbsoluteURL($route) {
30-
return Page::getByPath($route)->getCollectionLink();
31-
}
3223
}

0 commit comments

Comments
 (0)