Skip to content

Commit

Permalink
Migrate to BS5.0 and added support PHP 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Shevchuk committed Sep 1, 2021
1 parent fd471d9 commit 7ac218c
Show file tree
Hide file tree
Showing 18 changed files with 91 additions and 28 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
.DS_Store
.idea
vendor
composer.lock
composer.phar
44 changes: 44 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
checks:
php:
code_rating: true
deprecated_code_usage: true
duplication: true
no_short_open_tag: true
build:
cache:
directories:
- "vendor"
- "~/.composer"
nodes:
analysis:
tests:
override:
- php-scrutinizer-run
dependencies:
override:
- COMPOSER_ROOT_VERSION=dev-master
filter:
excluded_paths:
- "bin/"
- "data/"
- "docs/"
- "docker/"
- "public/"
- "tests/"
dependency_paths:
- "vendor/"
tools:
external_code_coverage: false
php_analyzer: true
php_code_sniffer:
config:
standard: PSR12
php_cpd:
enabled: true
excluded_dirs: [bin, data, docs, docker, public, tests, vendor]
php_loc:
enabled: true
excluded_dirs: [bin, data, docs, docker, public, tests, vendor]
php_mess_detector: true
php_pdepend: true
sensiolabs_security_checker: true
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
language: php
php:
- 7.1
- 7.2
- master
- 7.3
- 7.4
- 8.0
matrix:
allow_failures:
- php: master
- php: 8.0
env:
- BLUZ_MODULE=phones
before_install:
Expand All @@ -25,7 +25,7 @@ before_script:
- php vendor/bin/bluzman db:seed:run
script:
# Check code style
- php vendor/bin/phpcs ./application --standard=PSR1,PSR2 --encoding=utf-8 --ignore=./application/_loader.php
- php vendor/bin/phpcs ./application --standard=PSR12 --encoding=utf-8 --ignore=./application/_loader.php
# Run built-in web-server
- php vendor/bin/bluzman server:start --host 127.0.0.1 -b
# Run CodeCeption tests
Expand Down
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) 2012-2017 by Bluz PHP Team
Copyright (c) by Bluz PHP Team

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
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
# Module Users Profile for Bluz Skeleton

[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/bluzphp/main)
## Achievements

### Achievements
[![Latest Stable Version](https://img.shields.io/packagist/v/bluzphp/module-phones.svg?label=version&style=flat)](https://packagist.org/packages/bluzphp/module-phones)

[![License](https://poser.pugx.org/bluzphp/module-phones/license)](https://packagist.org/packages/bluzphp/module-phones)
[![Build Status](https://img.shields.io/travis/bluzphp/module-phones/master.svg?style=flat)](https://travis-ci.com/bluzphp/module-phones)

Usage
-------------------------
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/bluzphp/module-phones.svg?style=flat)](https://scrutinizer-ci.com/g/bluzphp/module-phones/)

[![Total Downloads](https://img.shields.io/packagist/dt/bluzphp/module-phones.svg?style=flat)](https://packagist.org/packages/bluzphp/module-phones)

[![License](https://img.shields.io/packagist/l/bluzphp/module-phones.svg?style=flat)](https://packagist.org/packages/bluzphp/module-phones)


## Usage
### Install module
To install the module run the command:

Expand Down
2 changes: 2 additions & 0 deletions application/models/UsersPhones/Crud.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @namespace
*/

namespace Application\UsersPhones;

/**
Expand Down
4 changes: 3 additions & 1 deletion application/models/UsersPhones/Grid.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @namespace
*/

namespace Application\UsersPhones;

use Bluz\Grid\Source\SelectSource;
Expand All @@ -24,7 +26,7 @@ class Grid extends \Bluz\Grid\Grid
/**
* @return void
*/
public function init() : void
public function init(): void
{
// Current table as source of grid
$adapter = new SelectSource();
Expand Down
6 changes: 5 additions & 1 deletion application/models/UsersPhones/Row.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @namespace
*/

namespace Application\UsersPhones;

use Bluz\Validator\Traits\Validator;
Expand All @@ -28,7 +30,7 @@ class Row extends \Bluz\Db\Row
/**
* @return void
*/
protected function afterRead() : void
protected function afterRead(): void
{
$this->addValidator('userId')
->numeric()
Expand All @@ -44,6 +46,8 @@ protected function afterRead() : void
* getUser
*
* @return \Application\Users\Row|false
* @throws \Bluz\Db\Exception\RelationNotFoundException
* @throws \Bluz\Db\Exception\TableNotFoundException
*/
public function getUser()
{
Expand Down
12 changes: 7 additions & 5 deletions application/models/UsersPhones/Table.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* @namespace
*/

namespace Application\UsersPhones;

/**
Expand All @@ -17,19 +19,19 @@ class Table extends \Bluz\Db\Table
/**
* Pending phone verification
*/
const STATUS_PENDING = 'pending';
public const STATUS_PENDING = 'pending';
/**
* Active phone number
*/
const STATUS_ACTIVE = 'active';
public const STATUS_ACTIVE = 'active';
/**
* Disabled by administrator or by user
*/
const STATUS_DISABLED = 'disabled';
public const STATUS_DISABLED = 'disabled';
/**
* Removed by user
*/
const STATUS_DELETED = 'deleted';
public const STATUS_DELETED = 'deleted';

/**
* @var string
Expand All @@ -52,7 +54,7 @@ class Table extends \Bluz\Db\Table
*
* @return void
*/
public function init() : void
public function init(): void
{
$this->linkTo('userId', 'Users', 'id');
}
Expand Down
Empty file.
1 change: 1 addition & 0 deletions application/modules/phones/controllers/crud.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* CRUD controller for UsersPhones model
*
Expand Down
1 change: 1 addition & 0 deletions application/modules/phones/controllers/crud/post.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* CRUD controller for POST method
*
Expand Down
3 changes: 2 additions & 1 deletion application/modules/phones/controllers/grid.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Grid controller for UsersPhones model
*
Expand Down Expand Up @@ -27,7 +28,7 @@
Layout::breadCrumbs(
[
Layout::ahref('Dashboard', ['dashboard', 'index']),
__('Pages')
__('Phones')
]
);
$grid = new UsersPhones\Grid();
Expand Down
Empty file.
8 changes: 3 additions & 5 deletions application/modules/phones/views/crud.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ $url = $this->url('phones', 'crud');
<input type="hidden" id="id" name="id" value="<?= $row['id'] ?>"/>
<div class="modal-header">
<h4 class="modal-title"><?=__('Phone number')?></h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<button type="button" class="btn-close" aria-label="Close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<div class="form-group row">
Expand Down Expand Up @@ -53,8 +51,8 @@ $url = $this->url('phones', 'crud');
<!-- Place additional form fields here -->
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Save</button>
<a href="#" class="btn btn-default" data-dismiss="modal">Close</a>
<button type="submit" class="btn btn-primary"><?=__('Save')?></button>
<button type="button" class="btn btn-light" data-bs-dismiss="modal"><?= __('Close') ?></button>
</div>
</form>
<?php
Expand Down
4 changes: 2 additions & 2 deletions application/modules/phones/views/grid.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ $uid = $grid->getUid();
<td class="controls d-flex justify-content-around">
<a href="<?= $this->url('phones', 'crud', ['id' => $row['id']]) ?>" class="btn btn-primary"
data-ajax-dialog data-ajax-method="get" data-modal-style="modal-lg">
<i class="fa fa-pencil"></i>
<i class="bi bi-pencil"></i>
</a>
<a href="<?= $this->url('phones', 'crud', ['id' => $row['id']]) ?>" class="btn btn-danger"
data-confirm data-ajax data-ajax-method="delete">
<i class="fa fa-trash-o"></i>
<i class="bi bi-trash"></i>
</a>
</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"license": "MIT",
"description": "bluz profile module",
"require": {
"bluzphp/composer-plugin": "~2.1"
"bluzphp/composer-plugin": "~2.4"
}
}
1 change: 0 additions & 1 deletion data/migrations/20171116155216_users_phones.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,5 @@ public function change()
'update' => 'CASCADE'
])
->create();

}
}

0 comments on commit 7ac218c

Please sign in to comment.