-
Notifications
You must be signed in to change notification settings - Fork 396
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added PHP CS Fixer to clean up code. Updated Travis configuration to work with new configuration. Update Composer configuration to work with new configuration. Overall tweaks in code to work with new naming conventions and fix minor bugs.
- Loading branch information
Showing
93 changed files
with
4,721 additions
and
4,081 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,7 @@ utils/dist/ | |
utils/tmp/ | ||
utils/starting_HEAD | ||
/.settings | ||
.idea/ | ||
vendor/ | ||
.php_cs.cache | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php | ||
|
||
use Symfony\CS\Config\Config; | ||
use Symfony\CS\FixerInterface; | ||
use Symfony\CS\Finder\DefaultFinder; | ||
|
||
$fixers = [ | ||
'blankline_after_open_tag', | ||
'braces', | ||
'concat_without_spaces', | ||
'double_arrow_multiline_whitespaces', | ||
'duplicate_semicolon', | ||
'elseif', | ||
'empty_return', | ||
'encoding', | ||
'eof_ending', | ||
'extra_empty_lines', | ||
'function_call_space', | ||
'function_declaration', | ||
'include', | ||
'indentation', | ||
'join_function', | ||
'line_after_namespace', | ||
'linefeed', | ||
'list_commas', | ||
'logical_not_operators_with_successor_space', | ||
'lowercase_constants', | ||
'lowercase_keywords', | ||
'method_argument_space', | ||
'multiline_array_trailing_comma', | ||
'multiline_spaces_before_semicolon', | ||
'multiple_use', | ||
'namespace_no_leading_whitespace', | ||
'no_blank_lines_after_class_opening', | ||
'no_empty_lines_after_phpdocs', | ||
'object_operator', | ||
'operators_spaces', | ||
'parenthesis', | ||
'phpdoc_indent', | ||
'phpdoc_inline_tag', | ||
'phpdoc_no_access', | ||
'phpdoc_no_package', | ||
'phpdoc_scalar', | ||
'phpdoc_short_description', | ||
'phpdoc_to_comment', | ||
'phpdoc_trim', | ||
'phpdoc_type_to_var', | ||
'phpdoc_var_without_name', | ||
'remove_leading_slash_use', | ||
'remove_lines_between_uses', | ||
'return', | ||
'self_accessor', | ||
'short_array_syntax', | ||
'short_echo_tag', | ||
'short_tag', | ||
'single_array_no_trailing_comma', | ||
'single_blank_line_before_namespace', | ||
'single_line_after_imports', | ||
'single_quote', | ||
'spaces_before_semicolon', | ||
'spaces_cast', | ||
'standardize_not_equal', | ||
'ternary_spaces', | ||
'trailing_spaces', | ||
'trim_array_spaces', | ||
'unalign_equals', | ||
'unary_operators_spaces', | ||
'unused_use', | ||
'visibility', | ||
'whitespacy_lines', | ||
]; | ||
|
||
return Config::create() | ||
->finder(DefaultFinder::create()->in(__DIR__)) | ||
->fixers($fixers) | ||
->level(FixerInterface::NONE_LEVEL) | ||
->setUsingCache(true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,32 @@ | ||
language: php | ||
|
||
php: | ||
- "5.4" | ||
- "5.5" | ||
- "5.6" | ||
script: | ||
- cd test | ||
- phpunit TestSuite.php | ||
- 5.4 | ||
- 5.5 | ||
- 5.6 | ||
- 7.0 | ||
- hhvm | ||
|
||
env: | ||
global: | ||
- setup=basic | ||
|
||
matrix: | ||
include: | ||
- php: 5.4 | ||
env: setup=lowest | ||
- php: 5.4 | ||
env: setup=stable | ||
|
||
sudo: false | ||
|
||
before_install: | ||
- travis_retry composer self-update | ||
|
||
install: | ||
- if [[ $setup = 'basic' ]]; then travis_retry composer install --no-interaction --prefer-dist; fi | ||
- if [[ $setup = 'stable' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-stable; fi | ||
- if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable; fi | ||
|
||
script: vendor/bin/phpunit | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,20 +4,18 @@ | |
* The purpose of this central config file is configuring all examples | ||
* in one place with minimal work for your working environment | ||
* Just configure all the items in this config according to your environment | ||
* and rename the file to config.php | ||
* and rename the file to config.php. | ||
* | ||
* PHP Version 5 | ||
* | ||
* @file config.php | ||
* @category Authentication | ||
* @package PhpCAS | ||
* @author Joachim Fritschi <[email protected]> | ||
* @author Adam Franco <[email protected]> | ||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 | ||
* @link https://wiki.jasig.org/display/CASC/phpCAS | ||
*/ | ||
|
||
$phpcas_path = '../../source/'; | ||
$CAS_path = '../../source/'; | ||
|
||
/////////////////////////////////////// | ||
// Basic Config of the phpCAS client // | ||
|
@@ -41,7 +39,7 @@ | |
|
||
// The "real" hosts of clustered cas server that send SAML logout messages | ||
// Assumes the cas server is load balanced across multiple hosts | ||
$cas_real_hosts = array('cas-real-1.example.com', 'cas-real-2.example.com'); | ||
$cas_real_hosts = ['cas-real-1.example.com', 'cas-real-2.example.com']; | ||
|
||
// Client config for cookie hardening | ||
$client_domain = '127.0.0.1'; | ||
|
@@ -64,41 +62,40 @@ | |
|
||
// Generating the URLS for the local cas example services for proxy testing | ||
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { | ||
$curbase = 'https://' . $_SERVER['SERVER_NAME']; | ||
$curbase = 'https://'.$_SERVER['SERVER_NAME']; | ||
} else { | ||
$curbase = 'http://' . $_SERVER['SERVER_NAME']; | ||
$curbase = 'http://'.$_SERVER['SERVER_NAME']; | ||
} | ||
if ($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) { | ||
$curbase .= ':' . $_SERVER['SERVER_PORT']; | ||
$curbase .= ':'.$_SERVER['SERVER_PORT']; | ||
} | ||
|
||
$curdir = dirname($_SERVER['REQUEST_URI']) . "/"; | ||
$curdir = dirname($_SERVER['REQUEST_URI']).'/'; | ||
|
||
// CAS client nodes for rebroadcasting pgtIou/pgtId and logoutRequest | ||
$rebroadcast_node_1 = 'http://cas-client-1.example.com'; | ||
$rebroadcast_node_2 = 'http://cas-client-2.example.com'; | ||
|
||
// access to a single service | ||
$serviceUrl = $curbase . $curdir . 'example_service.php'; | ||
$serviceUrl = $curbase.$curdir.'example_service.php'; | ||
// access to a second service | ||
$serviceUrl2 = $curbase . $curdir . 'example_service_that_proxies.php'; | ||
$serviceUrl2 = $curbase.$curdir.'example_service_that_proxies.php'; | ||
|
||
$pgtBase = preg_quote(preg_replace('/^http:/', 'https:', $curbase . $curdir), '/'); | ||
$pgtUrlRegexp = '/^' . $pgtBase . '.*$/'; | ||
$pgtBase = preg_quote(preg_replace('/^http:/', 'https:', $curbase.$curdir), '/'); | ||
$pgtUrlRegexp = '/^'.$pgtBase.'.*$/'; | ||
|
||
$cas_url = 'https://' . $cas_host; | ||
$cas_url = 'https://'.$cas_host; | ||
if ($cas_port != '443') { | ||
$cas_url = $cas_url . ':' . $cas_port; | ||
$cas_url = $cas_url.':'.$cas_port; | ||
} | ||
$cas_url = $cas_url . $cas_context; | ||
$cas_url = $cas_url.$cas_context; | ||
|
||
// Set the session-name to be unique to the current script so that the client script | ||
// doesn't share its session with a proxied script. | ||
// This is just useful when running the example code, but not normally. | ||
session_name( | ||
'session_for:' | ||
. preg_replace('/[^a-z0-9-]/i', '_', basename($_SERVER['SCRIPT_NAME'])) | ||
.preg_replace('/[^a-z0-9-]/i', '_', basename($_SERVER['SCRIPT_NAME'])) | ||
); | ||
// Set an UTF-8 encoding header for internation characters (User attributes) | ||
header('Content-Type: text/html; charset=utf-8'); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,31 +8,34 @@ | |
* CAS_PGTStorage_Db() options: | ||
* $db, $db_user, $db_password, $db_table, $driver_options | ||
* have to filled out directly. Option examples can be found in the | ||
* config.example.php | ||
* config.example.php. | ||
* | ||
* PHP Version 5 | ||
* | ||
* @file create_pgt_storage_table.php | ||
* @category Authentication | ||
* @package PhpCAS | ||
* @author Joachim Fritschi <[email protected]> | ||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 | ||
* @link https://wiki.jasig.org/display/CASC/phpCAS | ||
*/ | ||
|
||
// Load the autoloader | ||
require_once '../../vendor/autoload.php'; | ||
|
||
// Load the settings from the central config file | ||
require_once 'config.php'; | ||
// Load the CAS lib | ||
require_once $phpcas_path . '/CAS.php'; | ||
|
||
use phpCAS\CAS; | ||
use phpCAS\CAS\Client; | ||
use phpCAS\CAS\PGTStorage\Db; | ||
|
||
// Dummy client because we need a 'client' object | ||
$client = new CAS_Client( | ||
CAS_VERSION_2_0, true, $cas_host, $cas_port, $cas_context, false | ||
$client = new Client( | ||
CAS::CAS_VERSION_2_0, true, $cas_host, $cas_port, $cas_context, false | ||
); | ||
|
||
// Set the torage object | ||
$cas_obj = new CAS_PGTStorage_Db( | ||
// Set the storage object | ||
$cas_obj = new Db( | ||
$client, $db, $db_user, $db_password, $db_table, $driver_options | ||
); | ||
$cas_obj->init(); | ||
|
@@ -46,7 +49,7 @@ | |
<body> | ||
<div class="success"> | ||
<?php | ||
echo 'Table <b>' . $db_table . '</b> successfully created in database <b>' . $db . '</b>'; | ||
echo 'Table <b>'.$db_table.'</b> successfully created in database <b>'.$db.'</b>'; | ||
?> | ||
</div> | ||
</body> | ||
|
Oops, something went wrong.