<?php
namespace TYPO3\SingleSignOn\Client\Security\EntryPoint;

/*                                                                        *
 * This script belongs to the TYPO3 Flow package "TYPO3.SingleSignOn.Client".*
 *                                                                        *
 *                                                                        */

use TYPO3\Flow\Annotations as Flow;

/**
 * An entry point that redirects to the SSO server endpoint
 */
class SingleSignOnRedirect extends \TYPO3\Flow\Security\Authentication\EntryPoint\AbstractEntryPoint {

	/**
	 * @Flow\Inject
	 * @var \TYPO3\SingleSignOn\Client\Domain\Service\UrlService
	 */
	protected $urlService;

	/**
	 * Starts the authentication. (e.g. redirect to login page or send 401 HTTP header)
	 *
	 * @param \TYPO3\Flow\Http\Request $request The current request
	 * @param \TYPO3\Flow\Http\Response $response The current response
	 * @return void
	 */
	public function startAuthentication(\TYPO3\Flow\Http\Request $request, \TYPO3\Flow\Http\Response $response) {
		$callbackUrl = $request->getUri();
		$redirectUrl = $this->urlService->buildLoginRedirectUrl($callbackUrl);
		$response->setStatus(303);
		$response->setHeader('Location', $redirectUrl);
	}

}
?>

<?php
namespace TYPO3\SingleSignOn\Client\Security\EntryPoint;

/*                                                                        *
 * This script belongs to the TYPO3 Flow package "TYPO3.SingleSignOn.Client".*
 *                                                                        *
 *                                                                        */

use TYPO3\Flow\Annotations as Flow;

/**
 * An entry point that redirects to the SSO server endpoint
 */
class SingleSignOnRedirect extends \TYPO3\Flow\Security\Authentication\EntryPoint\AbstractEntryPoint {

	/**
	 * @Flow\Inject
	 * @var \TYPO3\SingleSignOn\Client\Domain\Service\UrlService
	 */
	protected $urlService;

	/**
	 * Starts the authentication by redirecting to the SSO endpoint
	 *
	 * The redirect includes the callback URI (the original URI from the given request)
	 * the client identifier and a signature of the arguments with the client private key.
	 *
	 * @param \TYPO3\Flow\Http\Request $request The current request
	 * @param \TYPO3\Flow\Http\Response $response The current response
	 * @return void
	 */
	public function startAuthentication(\TYPO3\Flow\Http\Request $request, \TYPO3\Flow\Http\Response $response) {
		$callbackUrl = $request->getUri();
		$redirectUrl = $this->urlService->buildLoginRedirectUrl($callbackUrl);
		$response->setStatus(303);
		$response->setHeader('Location', $redirectUrl);
	}

}
?>

Add documentation for entry point

[TASK] Add documentation for entry point


<?php
namespace Neos\Flow\Reflection;

/*
 * This file is part of the Neos.Flow package.
 *
 * (c) Contributors of the Neos Project - www.neos.io
 *
 * This package is Open Source Software. For the full copyright and license
 * information, please view the LICENSE file which was distributed with this
 * source code.
 */

use Neos\Flow\Annotations as Flow;

/**
 * Extended version of the ReflectionParameter
 *
 * @Flow\Proxy(false)
 */
class ParameterReflection extends \ReflectionParameter
{
    /**
     * @var string
     */
    protected $parameterClassName;

    /**
     * Returns the declaring class
     *
     * @return ClassReflection The declaring class
     */
    public function getDeclaringClass()
    {
        return new ClassReflection(parent::getDeclaringClass()->getName());
    }

    /**
     * Returns the parameter class
     *
     * @return ClassReflection The parameter class
     */
    public function getClass()
    {
        try {
            $class = parent::getClass();
        } catch (\Exception $exception) {
            return null;
        }

        return is_object($class) ? new ClassReflection($class->getName()) : null;
    }

    /**
     * @return string The name of a builtin type (e.g. string, int) if it was declared for the parameter (scalar type declaration), null otherwise
     */
    public function getBuiltinType()
    {
        if (!is_callable([$this, 'getType'])) {
            return null;
        }
        $type = $this->getType();
        if ($type === null || !$type->isBuiltin()) {
            return null;
        }
        return (string)$type;
    }
}

<?php
namespace Neos\Flow\Reflection;

/*
 * This file is part of the Neos.Flow package.
 *
 * (c) Contributors of the Neos Project - www.neos.io
 *
 * This package is Open Source Software. For the full copyright and license
 * information, please view the LICENSE file which was distributed with this
 * source code.
 */

use Neos\Flow\Annotations as Flow;

/**
 * Extended version of the ReflectionParameter
 *
 * @Flow\Proxy(false)
 */
class ParameterReflection extends \ReflectionParameter
{
    /**
     * @var string
     */
    protected $parameterClassName;

    /**
     * Returns the declaring class
     *
     * @return ClassReflection The declaring class
     */
    public function getDeclaringClass()
    {
        return new ClassReflection(parent::getDeclaringClass()->getName());
    }

    /**
     * Returns the parameter class
     *
     * @return ClassReflection The parameter class
     */
    public function getClass()
    {
        try {
            $class = parent::getClass();
        } catch (\Exception $exception) {
            return null;
        }

        return is_object($class) ? new ClassReflection($class->getName()) : null;
    }

    /**
     * @return string The name of a builtin type (e.g. string, int) if it was declared for the parameter (scalar type declaration), null otherwise
     */
    public function getBuiltinType()
    {
        $type = $this->getType();
        if ($type === null || !$type->isBuiltin()) {
            return null;
        }
        return $type instanceof \ReflectionNamedType ? $type->getName() : (string)$type;
    }
}

BUGFIX: Remove pre-PHP7 code and avoid __toString deprecation warning


<?php include 'header_meta_inc_view.php';?>

<?php include 'header_inc_view.php';?>

CSV Converter

            <form action="<?php echo site_url(); ?>/csv_to_json" method="post" role="form" enctype="multipart/form-data">

                    Upload a CSV File
                    <input type="file" name="csv_upload">

                    <input type="submit" value="Convert" class="btn btn-primary">

            </form>

<?php include 'footer.php'; ?>

<?php include 'header_meta_inc_view.php';?>

<?php include 'header_inc_view.php';?>

CSV Converter

            <form action="<?php echo site_url(); ?>/datagov/csv_to_json" method="post" role="form" enctype="multipart/form-data">

                    Upload a CSV File
                    <input type="file" name="csv_upload">

                    <input type="submit" value="Convert" class="btn btn-primary">

            </form>

<?php include 'footer.php'; ?>

Fix broken path on CSV converter form

Fix broken path on CSV converter form


<?php

namespace Qobo\Robo\Task\Cakephp;

use Robo\Result;

/**
 * Run CakePHP Migration
 *
 * ```php
 * <?php
 * $this->taskCakephpAdminAdd()
 * ->username('vasja')
 * ->password('pupkin')
 * ->email('vasja@pupkin.me')
 * ->run();
 *
 * ?>
 * ```
 */
class AdminAdd extends \Qobo\Robo\AbstractCmdTask
{
    /**
     * {@inheritdoc}
     */
    protected $data = [
        'cmd'   => './bin/cake users addSuperuser %%USERNAME%% %%PASSWORD%% %%EMAIL%%',
        'path'  => ['./'],
        'batch' => false,
        'username' => null,
        'password' => null,
        'email' => null
    ];

    /**
     * {@inheritdoc}
     */
    protected $requiredData = [
        'username',
        'password'
    ];

    /**
     * {@inheritdoc}
     */
    protected $tokenKeys = [
        ['username', '--username='],
        ['password', '--password=']
    ];
}

<?php

namespace Qobo\Robo\Task\Cakephp;

use Robo\Result;

/**
 * Run CakePHP Migration
 *
 * ```php
 * <?php
 * $this->taskCakephpAdminAdd()
 * ->username('vasja')
 * ->password('pupkin')
 * ->email('vasja@pupkin.me')
 * ->run();
 *
 * ?>
 * ```
 */
class AdminAdd extends \Qobo\Robo\AbstractCmdTask
{
    /**
     * {@inheritdoc}
     */
    protected $data = [
        'cmd'   => './bin/cake users addSuperuser %%USERNAME%% %%PASSWORD%% %%EMAIL%%',
        'path'  => ['./'],
        'batch' => false,
        'username' => null,
        'password' => null,
        'email' => null
    ];

    /**
     * {@inheritdoc}
     */
    protected $requiredData = [
        'username',
        'password'
    ];

    /**
     * {@inheritdoc}
     */
    protected $tokenKeys = [
        ['username', '--username='],
        ['password', '--password='],
        ['email', '--email']
    ];
}

Fix missing --email before actual email for builder cakephp useradd task


<?php namespace Orchestra\Asset;

use Illuminate\Support\ServiceProvider;
use Illuminate\Foundation\AliasLoader;

class AssetServiceProvider extends ServiceProvider
{
    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var boolean
     */
    protected $defer = true;

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->app['orchestra.asset'] = $this->app->share(function ($app) {
            return new Environment($app);
        });

        $this->app->booting(function () {
            $loader = AliasLoader::getInstance();
            $loader->alias('Orchestra\Asset', 'Orchestra\Support\Facades\Asset');
        });
    }

    /**
     * Get the services provided by the provider.
     *
     * @return array
     */
    public function provides()
    {
        return array('orchestra.asset');
    }
}

<?php namespace Orchestra\Asset;

use Illuminate\Support\ServiceProvider;
use Illuminate\Foundation\AliasLoader;

class AssetServiceProvider extends ServiceProvider
{
    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var boolean
     */
    protected $defer = true;

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->app->bindShared('orchestra.asset', function ($app) {
            return new Environment($app);
        });

        $this->app->booting(function () {
            $loader = AliasLoader::getInstance();
            $loader->alias('Orchestra\Asset', 'Orchestra\Support\Facades\Asset');
        });
    }

    /**
     * Get the services provided by the provider.
     *
     * @return array
     */
    public function provides()
    {
        return array('orchestra.asset');
    }
}

Update service provider to use bindShared.

Signed-off-by: crynobone <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com>


<?php

// Set default settings here. Can be overridden in config.php.
    $settings = array();
    $settings['sqlColor'] = true;

	require_once('config.php');

	$dbh = new PDO($reviewhost['dsn'], $reviewhost['user'], $reviewhost['password'], array( PDO::ATTR_PERSISTENT => true ));

    require_once('libs/sqlquery/SqlParser.php');

<?php

// Set default settings here. Can be overridden in config.php.
    $settings = array();
    $settings['sqlColor'] = true;

	require_once('config.php');

	$dbh = new PDO($reviewhost['dsn'], $reviewhost['user'], $reviewhost['password']);

    require_once('libs/sqlquery/SqlParser.php');

Remove persistant conections. Does not seem to work so well


<?php

$general_details = array (

		array(
		  'name'        => 'posts-header',
			'std'         => '',
			'type'        => 'textarea',
			'title'       => __('Header HTML:', $theme_code),
			'description' => '')

  );

function general_details () {
  global $general_details;
  new_options( 'posts', false, $general_details);
}

function create_meta_box () {
	if ( function_exists('add_meta_box') ) {
		add_meta_box( 'general_details', __('General Information', $theme_code), 'general_details', 'post', 'normal', 'high' );
	}
}

add_action('admin_menu', 'create_meta_box');

<?php

$general_details = array (

		array(
		  'name'        => 'posts-header',
			'std'         => '',
			'type'        => 'textarea',
			'title'       => __('Header HTML:', $theme_code),
			'description' => ''),

		array(
		  'name'        => 'linked_list_url',
			'std'         => '',
			'type'        => 'text',
			'title'       => __('Linked List URL:', $theme_code),
			'description' => '')

  );

function general_details () {
  global $general_details;
  new_options( 'posts', false, $general_details);
}

function create_meta_box () {
	if ( function_exists('add_meta_box') ) {
		add_meta_box( 'general_details', __('General Information', $theme_code), 'general_details', 'post', 'normal', 'high' );
	}
}

add_action('admin_menu', 'create_meta_box');

Add an easy-to-use option for linked list items in backend


	<?php if (post_password_required()) { ?>

Enter your password to view any comments.

		<?php return;
	} ?>

	<?php if (have_comments()) { ?>

			<?php wp_list_comments(array("avatar_size"=>48,"style"=>"div")); ?>

		<?php if (get_comment_pages_count() > 1 && get_option('page_comments')) { ?>

				<?php paginate_comments_links(); ?>

		<?php }
	} ?>

	<?php comment_form(); ?>

	<?php if (post_password_required()) { ?>

Enter your password to view any comments.

	<?php }
	elseif (have_comments()) { ?>

			<?php wp_list_comments(array("avatar_size"=>48,"style"=>"div")); ?>

		<?php if (get_comment_pages_count() > 1 && get_option('page_comments')) { ?>

				<?php paginate_comments_links(); ?>

		<?php }
	}

	comment_form(); ?>

Fix missing div on passworded post.

Fix missing div on passworded post.


<?php
namespace Conduit\Middleware;

use Phly\Conduit\MiddlewareInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use Aura\Router\Router;
use Aura\Dispatcher\Dispatcher;
use Aura\Di\Container;

class ApplicationMiddleware implements MiddlewareInterface
{
    private $container;

    public function __construct(Container $container)
    {
        $this->container = $container;
    }

    public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next = null)
    {
        $router = $this->container->get('router');
        $dispatcher = $this->container->get('dispatcher');
        $server = $request->getServerParams();
        $path = parse_url($server['REQUEST_URI'], PHP_URL_PATH);
        $route = $router->match($path, $server);
        if (! $route) {
            return $next($request, $response);
        }
        $params = $route->params;
        if (is_string($params['controller'])) {
            // create the controller object
            $params['controller'] = $this->container->newInstance($params['controller']);
        }
        $params['request'] = $request;
        $params['response'] = $response;
        $result = $dispatcher->__invoke($params);
        if ($result instanceof ResponseInterface) {
            return $result;
        }
        if (is_string($result)) {
            return $response->write($result);
        }
        return $response;
    }
}

<?php
namespace Conduit\Middleware;

use Phly\Conduit\MiddlewareInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use Aura\Router\Router;
use Aura\Dispatcher\Dispatcher;
use Aura\Di\Container;

class ApplicationMiddleware implements MiddlewareInterface
{
    private $container;

    public function __construct(Container $container)
    {
        $this->container = $container;
    }

    public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next = null)
    {
        $router = $this->container->get('router');
        $dispatcher = $this->container->get('dispatcher');
        $server = $request->getServerParams();
        $path = parse_url($server['REQUEST_URI'], PHP_URL_PATH);
        $route = $router->match($path, $server);
        if (! $route) {
            return $next($request, $response);
        }
        $params = $route->params;
        if (is_string($params['controller']) &&
            ! $this->dispatcher->hasObject($params['controller'])
        ) {
            // create the controller object
            $params['controller'] = $this->container->newInstance($params['controller']);
        }
        $params['request'] = $request;
        $params['response'] = $response;
        $result = $dispatcher->__invoke($params);
        if ($result instanceof ResponseInterface) {
            return $result;
        }
        if (is_string($result)) {
            return $response->write($result);
        }
        return $response;
    }
}

Check and makse sure we have no dispatcher object


<?php

declare(strict_types=1);

namespace Rinvex\Attributes\Console\Commands;

use Illuminate\Console\Command;

class RollbackCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'rinvex:rollback:attributes {--force : Force the operation to run when in production.}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Rollback Rinvex Attributes Tables.';

    /**
     * Execute the console command.
     *
     * @return void
     */
    public function handle(): void
    {
        $this->alert($this->description);

        if (file_exists($path = 'database/migrations/rinvex/laravel-attributes')) {
            $this->call('migrate:reset', [
                '--step' => true,
                '--path' => $path,
                '--force' => $this->option('force'),
            ]);
        } else {
            $this->warn('No migrations found! Consider publish them first: <fg=green>php artisan rinvex:publish:attributes</>');
        }

        $this->line('');
    }
}

<?php

declare(strict_types=1);

namespace Rinvex\Attributes\Console\Commands;

use Illuminate\Console\Command;

class RollbackCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'rinvex:rollback:attributes {--force : Force the operation to run when in production.}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Rollback Rinvex Attributes Tables.';

    /**
     * Execute the console command.
     *
     * @return void
     */
    public function handle(): void
    {
        $this->alert($this->description);

        if (file_exists($path = 'database/migrations/rinvex/laravel-attributes')) {
            $this->call('migrate:reset', [
                '--path' => $path,
                '--force' => $this->option('force'),
            ]);
        } else {
            $this->warn('No migrations found! Consider publish them first: <fg=green>php artisan rinvex:publish:attributes</>');
        }

        $this->line('');
    }
}

Fix `migrate:reset` args as it doesn't accept --step


<?php
/**
 * @package: chapi
 *
 * @author: bthapaliya
 * @since: 2016-10-16
 *
 */
namespace Chapi\Entity\Marathon\AppEntity;

use Chapi\Entity\Marathon\AppEntity\DockerParameters;
use Chapi\Entity\Marathon\AppEntity\DockerPortMapping;
use Chapi\Entity\Marathon\MarathonEntityUtils;

class Docker
{
    const DIC = self::class;

    public $image = '';

    public $network = '';

    /**
     * @var DockerPortMapping[]
     */
    public $portMappings = [];

    public $privileged = false;

    /**
     * @var DockerParameters
     */
    public $parameters = [];

    public function __construct($aData = [])
    {
        MarathonEntityUtils::setAllPossibleProperties($aData, $this);

        if (isset($aData['portMappings']))
        {
            foreach ($aData['portMappings'] as $portMapping)
            {
                $this->portMappings[] = new DockerPortMapping((array) $portMapping);
            }
        }

        if (isset($aData['parameters']))
        {
            foreach ($aData['parameters'] as $parameter)
            {
                $this->parameters[] = new DockerParameters((array) $parameter);
            }
        }

    }
}

<?php
/**
 * @package: chapi
 *
 * @author: bthapaliya
 * @since: 2016-10-16
 *
 */
namespace Chapi\Entity\Marathon\AppEntity;

use Chapi\Entity\Marathon\AppEntity\DockerParameters;
use Chapi\Entity\Marathon\AppEntity\DockerPortMapping;
use Chapi\Entity\Marathon\MarathonEntityUtils;

class Docker
{
    const DIC = self::class;

    public $image = '';

    public $network = '';

    /**
     * @var DockerPortMapping[]
     */
    public $portMappings = [];

    public $privileged = false;

    public $forcePullImage = false;

    /**
     * @var DockerParameters
     */
    public $parameters = [];

    public function __construct($aData = [])
    {
        MarathonEntityUtils::setAllPossibleProperties($aData, $this);

        if (isset($aData['portMappings']))
        {
            foreach ($aData['portMappings'] as $portMapping)
            {
                $this->portMappings[] = new DockerPortMapping((array) $portMapping);
            }
        }

        if (isset($aData['parameters']))
        {
            foreach ($aData['parameters'] as $parameter)
            {
                $this->parameters[] = new DockerParameters((array) $parameter);
            }
        }

    }
}

Add force pull image option in docker sub entity


<?php

namespace Studio\Shell;

use Symfony\Component\Process\Process;

class TaskRunner
{

    public function run($task, $directory = null)
    {
        $process = new Process("$task", $directory);
        $process->run();

        if (! $process->isSuccessful()) {
            $error = $process->getErrorOutput();
            throw new \RuntimeException("Error while running Composer: $error");
        }

        return $process->getOutput();
    }

}

<?php

namespace Studio\Shell;

use Symfony\Component\Process\Process;

class TaskRunner
{

    public function run($task, $directory = null)
    {
        $process = new Process("$task", $directory);
        $process->setTimeout(600);
        $process->run();

        if (! $process->isSuccessful()) {
            $error = $process->getErrorOutput();
            throw new \RuntimeException("Error while running Composer: $error");
        }

        return $process->getOutput();
    }

}

Increase default timeout for shell tasks.


<?php
namespace DrupalReleaseDate\Controllers;

use Silex\Application;
use Symfony\Component\HttpFoundation\Request;

class Charts
{

    public function samples(Application $app, Request $request)
    {
        return $app['twig']->render('graphs/samples.twig', array(
            'scripts' => array(
                'http://code.jquery.com/jquery-2.0.2.min.js',
                'https://www.google.com/jsapi',
            ),
        ));
    }

    public function estimates(Application $app, Request $request)
    {
        return $app['twig']->render('graphs/estimates.twig', array(
            'scripts' => array(
                'http://code.jquery.com/jquery-2.0.2.min.js',
                'https://www.google.com/jsapi',
            ),
        ));
    }

    public function distribution(Application $app, Request $request)
    {
        return $app['twig']->render('graphs/distribution.twig', array(
            'scripts' => array(
                'http://code.jquery.com/jquery-2.0.2.min.js',
                'https://www.google.com/jsapi',
            ),
        ));
    }
}

<?php
namespace DrupalReleaseDate\Controllers;

use Silex\Application;
use Symfony\Component\HttpFoundation\Request;

class Charts
{

    public function samples(Application $app, Request $request)
    {
        return $app['twig']->render('graphs/samples.twig', array(
            'scripts' => array(
                '//code.jquery.com/jquery-2.0.2.min.js',
                'https://www.google.com/jsapi',
            ),
        ));
    }

    public function estimates(Application $app, Request $request)
    {
        return $app['twig']->render('graphs/estimates.twig', array(
            'scripts' => array(
                '//code.jquery.com/jquery-2.0.2.min.js',
                'https://www.google.com/jsapi',
            ),
        ));
    }

    public function distribution(Application $app, Request $request)
    {
        return $app['twig']->render('graphs/distribution.twig', array(
            'scripts' => array(
                '//code.jquery.com/jquery-2.0.2.min.js',
                'https://www.google.com/jsapi',
            ),
        ));
    }
}

Use protocol relative URLs for jQuery CDN to avoid mixed-content errors


<?php

class JsonTest extends PHPUnit_Framework_TestCase
{
    /**
     * @dataProvider jsonFileProvider
     */
    public function testJsonFile($file)
    {
        $filePath = __DIR__ . '/../data/' . $file;

        $this->assertFileExists($filePath);

        $data = json_decode(file_get_contents($filePath), true);

        $this->assertEquals(JSON_ERROR_NONE, json_last_error());
        $this->assertGreaterThan(0, count($data));

        // Check data integrity.
        $keys = [];
        foreach ($data as $entry) {
            $this->assertArrayHasKey('key', $entry);
            $this->assertArrayHasKey('name', $entry);
            $this->assertNotContains($entry['key'], $keys, 'Key must be unique within the file.');
            $keys[] = $entry['key'];
        }
    }

    public function jsonFileProvider()
    {
        return [
            ['user-groups.json'],
            ['conferences.json'],
        ];
    }
}

<?php

class JsonTest extends PHPUnit_Framework_TestCase
{
    /**
     * @dataProvider jsonFileProvider
     */
    public function testJsonFile($file)
    {
        $filePath = __DIR__ . '/../data/' . $file;

        $this->assertFileExists($filePath);

        $data = json_decode(file_get_contents($filePath), true);

        $this->assertEquals(JSON_ERROR_NONE, json_last_error());
        $this->assertGreaterThan(0, count($data));

        // Check data integrity.
        $keys = [];
        foreach ($data as $i => $entry) {
            $this->assertArrayHasKey('key', $entry, 'Entry #'.$i);
            $this->assertArrayHasKey('name', $entry, 'Entry '.$entry['key']);
            $this->assertArrayHasKey('first_event', $entry, 'Entry '.$entry['key']);
            $this->assertNotContains($entry['key'], $keys, 'Key must be unique within the file.');
            $keys[] = $entry['key'];
        }
    }

    public function jsonFileProvider()
    {
        return [
            ['user-groups.json'],
            ['conferences.json'],
        ];
    }
}

Test additional fields and display which entry is problematic.


<?php

/** @var rtSitePage $rt_site_page */

use_helper('I18N', 'Date', 'rtText')

?>

    <?php echo link_to(__('Edit Page'), 'rtSitePageAdmin/edit?id='.$rt_site_page->getId(), array('class' => 'rt-admin-edit-tools-trigger')) ?>

  <?php if(sfConfig::get('app_rt_templates_headers_embedded', true)): ?>

<?php echo $rt_site_page->getTitle() ?>

  <?php endif; ?>

    <?php echo markdown_to_html($rt_site_page->getContent(), $rt_site_page); ?>

<?php

/** @var rtSitePage $rt_site_page */

use_helper('I18N', 'Date', 'rtText')

?>

  <?php if(sfConfig::get('app_rt_templates_headers_embedded', true)): ?>

<?php echo $rt_site_page->getTitle() ?>

  <?php endif; ?>

    <?php echo markdown_to_html($rt_site_page->getContent(), $rt_site_page); ?>

Update to ready the blog plugin for new layout changes.


<?php

/* Find the authentication state. */
if (!array_key_exists('AuthState', $_REQUEST) || empty($_REQUEST['AuthState'])) {
	throw new SimpleSAML_Error_BadRequest('Missing mandatory parameter: AuthState');
}

$authState = $_REQUEST['AuthState'];
$state = SimpleSAML_Auth_State::loadState($authState, 'openid:init');
$sourceId = $state['openid:AuthId'];
$authSource = SimpleSAML_Auth_Source::getById($sourceId);
if ($authSource === NULL) {
	throw new SimpleSAML_Error_BadRequest('Invalid AuthId \'' . $sourceId . '\' - not found.');
}

try {
	if (!empty($_GET['openid_url'])) {
		$authSource->doAuth($state, (string)$_GET['openid_url']);
	}
} catch (Exception $e) {
	$error = $e->getMessage();
}

$config = SimpleSAML_Configuration::getInstance();
$t = new SimpleSAML_XHTML_Template($config, 'openid:consumer.php', 'openid');
$t->data['error'] = $error;
$t->data['AuthState'] = $authState;
$t->show();

<?php

/* Find the authentication state. */
if (!array_key_exists('AuthState', $_REQUEST) || empty($_REQUEST['AuthState'])) {
	throw new SimpleSAML_Error_BadRequest('Missing mandatory parameter: AuthState');
}

$authState = $_REQUEST['AuthState'];
$state = SimpleSAML_Auth_State::loadState($authState, 'openid:init');
$sourceId = $state['openid:AuthId'];
$authSource = SimpleSAML_Auth_Source::getById($sourceId);
if ($authSource === NULL) {
	throw new SimpleSAML_Error_BadRequest('Invalid AuthId \'' . $sourceId . '\' - not found.');
}

$error = NULL;
try {
	if (!empty($_GET['openid_url'])) {
		$authSource->doAuth($state, (string)$_GET['openid_url']);
	}
} catch (Exception $e) {
	$error = $e->getMessage();
}

$config = SimpleSAML_Configuration::getInstance();
$t = new SimpleSAML_XHTML_Template($config, 'openid:consumer.php', 'openid');
$t->data['error'] = $error;
$t->data['AuthState'] = $authState;
$t->show();

openid: Fix notice about unititialized variable.


<?php

namespace Rogue\Console\Commands;

use Rogue\Models\Post;
use Rogue\Services\AWS;
use Illuminate\Console\Command;
use Intervention\Image\Facades\Image;

class EditImagesCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'rogue:images {start=1}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Create cropped & resized images for every post.';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle(AWS $aws)
    {
        $start = $this->argument('start');

        Post::where('id', '>', $start)->chunk(100, function ($posts) use ($aws) {
            foreach ($posts as $post) {
                $image = $post->url;
                $editedImage = (string) Image::make($image)
                    ->orientate()
                    ->fit(400)
                    ->encode('jpg', 75);

                $aws->storeImageData($editedImage, 'edited_'.$post->id);

                $this->line('Saved edited image for post '.$post->id);
            }
        });
    }
}

<?php

namespace Rogue\Console\Commands;

use Rogue\Models\Post;
use Rogue\Services\AWS;
use Illuminate\Console\Command;
use Intervention\Image\Exception\ImageException;
use Intervention\Image\Facades\Image;

class EditImagesCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'rogue:images {start=1}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Create cropped & resized images for every post.';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle(AWS $aws)
    {
        $start = $this->argument('start');

        Post::where('id', '>', $start)->chunk(100, function ($posts) use ($aws) {
            foreach ($posts as $post) {
                $image = $post->url;

                try {
                    $editedImage = (string) Image::make($image)
                        ->orientate()
                        ->fit(400)
                        ->encode('jpg', 75);

                    $aws->storeImageData($editedImage, 'edited_'.$post->id);
                } catch (ImageException $e) {
                    $this->error('Failed to edit image for post '.$post->id);
                }

                $this->line('Saved edited image for post '.$post->id);
            }
        });
    }
}

Handle exceptions when cropping images.

Handle exceptions when cropping images.


<?php

namespace RadDB\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class UpdateMachineRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'modality'     => 'required|integer',
            'description'  => 'required|string|max:60',
            'manufacturer' => 'required|integer',
            'model'        => 'required|string|max:50',
            'serialNumber' => 'required|string|max:20',
            'softwareVersion' => 'string|max:50',
            'vendSiteID'   => 'string|nullable|max:25',
            'manufDate'    => 'date_format:Y-m-d|nullable',
            'installDate'  => 'date_format:Y-m-d|nullable',
            'location'     => 'required|integer',
            'room'         => 'required|string|max:20',
            'status'       => 'required|in:Active,Inactive,Removed|max:50',
            'notes'        => 'string|nullable|max:65535',
        ];
    }
}

<?php

namespace RadDB\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class UpdateMachineRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'modality'     => 'required|integer',
            'description'  => 'required|string|max:60',
            'manufacturer' => 'required|integer',
            'model'        => 'required|string|max:50',
            'serialNumber' => 'required|string|max:20',
            'softwareVersion' => 'string|max:50|nullable',
            'vendSiteID'   => 'string|nullable|max:25',
            'manufDate'    => 'date_format:Y-m-d|nullable',
            'installDate'  => 'date_format:Y-m-d|nullable',
            'location'     => 'required|integer',
            'room'         => 'required|string|max:20',
            'status'       => 'required|in:Active,Inactive,Removed|max:50',
            'notes'        => 'string|nullable|max:65535',
        ];
    }
}

Add nullable validation rule to software version field


Fix issue with https and Google analytics tracking code.

Use `str::after($string, $after);` to always get the (sub)domain without `http://` or `https://`.


<?php

namespace PhpWatson\Sdk\Interfaces;

use GuzzleHttp\Client as GuzzleClient;

interface ClientInterface
{
    /**
     * Make a HTTP request
     *
     * @param $method
     * @param $uri
     * @param $options
     * @return mixed|\Psr\Http\Message\ResponseInterface
     */
    public function request($method, $uri, $options = []);

    /**
     * Set the current Guzzle instance
     * @param GuzzleClient $guzzle
     * @return
     * @internal param GuzzleClient $client
     */
    public function setGuzzleInstance(GuzzleClient $guzzle);
}

<?php

namespace PhpWatson\Sdk\Interfaces;

use GuzzleHttp\Client as GuzzleClient;

interface ClientInterface
{
    /**
     * Make a HTTP request
     *
     * @param $method
     * @param $uri
     * @param $options
     * @return mixed|\Psr\Http\Message\ResponseInterface
     */
    public function request($method, $uri, $options = []);

    /**
     * Set the current Guzzle instance
     *
     * @param GuzzleClient $guzzle
     * @return
     * @internal param GuzzleClient $client
     */
    public function setGuzzleInstance(GuzzleClient $guzzle);

    /**
     * Get the client options
     *
     * @return array
     */
    public function getOptions();

    /**
     *  Set the client options merging and/or overwriting its contents
     *
     * @param array $options
     * @return null
     */
    public function setOptions(array $options);
}

Add client options getter and setter

Add client options getter and setter


<?php

namespace Rogue\Http\Controllers;

use Rogue\Models\Signup;
use Illuminate\Http\Request;
use Rogue\Services\Registrar;
use Rogue\Services\CampaignService;

class SignupsController extends Controller
{
    /**
     * Registrar instance
     *
     * @var Rogue\Services\Registrar
     */
    protected $registrar;

    /**
     * Phoenix instance
     *
     * @var Rogue\Services\CampaignService
     */
    protected $campaignService;

    /**
     * Constructor
     *
     * @param Rogue\Services\Registrar $registrar
     * @param Rogue\Services\CampaignService $campaignService
     */
    public function __construct(Registrar $registrar, CampaignService $campaignService)
    {
        $this->middleware('auth');
        $this->middleware('role:admin,staff');

        $this->registrar = $registrar;
        $this->campaignService = $campaignService;
    }

    /**
     * Display the specified resource.
     *
     * @param  string  $id  signup id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        $signup = Signup::find($id);
        $campaign = $this->campaignService->find($id);

        return view('signups.show')
            ->with('state', [
                'signup' => $signup,
                'campaign' => $campaign,
            ]);
    }
}

<?php

namespace Rogue\Http\Controllers;

use Rogue\Models\Signup;
use Illuminate\Http\Request;
use Rogue\Services\Registrar;
use Rogue\Services\CampaignService;

class SignupsController extends Controller
{
    /**
     * Registrar instance
     *
     * @var Rogue\Services\Registrar
     */
    protected $registrar;

    /**
     * Phoenix instance
     *
     * @var Rogue\Services\CampaignService
     */
    protected $campaignService;

    /**
     * Constructor
     *
     * @param Rogue\Services\Registrar $registrar
     * @param Rogue\Services\CampaignService $campaignService
     */
    public function __construct(Registrar $registrar, CampaignService $campaignService)
    {
        $this->middleware('auth');
        $this->middleware('role:admin,staff');

        $this->registrar = $registrar;
        $this->campaignService = $campaignService;
    }

    /**
     * Display the specified resource.
     *
     * @param  string  $id  signup id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        $signup = Signup::find($id);
        $campaign = $this->campaignService->find($id);
        $user = $this->registrar->find($signup->northstar_id);

        return view('signups.show', compact('campaign'))
            ->with('state', [
                'signup' => $signup,
                'campaign' => $campaign,
                'user' => $user->toArray(),
            ]);
    }
}

Send user information to the state

Send user information to the state


<?php

namespace Omnipay\Common;

use Mockery as m;
use Omnipay\TestCase;

class AbstractGatewayTest extends TestCase
{
    public function setUp()
    {
        $this->gateway = m::mock("\Omnipay\Common\AbstractGateway[getName,getDefaultParameters,purchase]");
    }

    public function testGetShortName()
    {
        // test a couple of known getShortName() examples
        $gateway = GatewayFactory::create('PayPal_Express');
        $this->assertSame('PayPal_Express', $gateway->getShortName());

        $gateway = GatewayFactory::create('Stripe');
        $this->assertSame('Stripe', $gateway->getShortName());
    }
}

<?php

namespace Omnipay\Common;

use Mockery as m;
use Omnipay\TestCase;

class AbstractGatewayTest extends TestCase
{
    public function setUp()
    {
        $this->gateway = m::mock("\Omnipay\Common\AbstractGateway[getName,getDefaultParameters,purchase]");
    }

    public function testGetShortName()
    {
        $this->assertSame('\\'.get_class($this->gateway), $this->gateway->getShortName());
    }
}

Fix test relying on gateway implementaions


<?php

/**
 * GridField config necessary for managing a SiteTree object.
 *
 * @package silverstripe
 * @subpackage blog
 *
 * @author Michael Strong <github@michaelstrong.co.uk>
**/
class GridFieldConfig_BlogPost extends GridFieldConfig {

	public function __construct($itemsPerPage = null) {
		parent::__construct($itemsPerPage);
		$this->addComponent(new GridFieldButtonRow('before'));
		$this->addComponent(new GridFieldSiteTreeAddNewButton('buttons-before-left'));
		$this->addComponent(new GridFieldToolbarHeader());
		$this->addComponent(new GridFieldSortableHeader());
		$this->addComponent(new GridFieldFilterHeader());
		$this->addComponent(new GridFieldDataColumns());
		$this->addComponent(new GridFieldSiteTreeEditButton());
		$this->addComponent(new GridFieldPageCount('toolbar-header-right'));
		$this->addComponent($pagination = new GridFieldPaginator($itemsPerPage));
		$this->addComponent(new GridFieldBlogPostState());

		$pagination->setThrowExceptionOnBadDataType(true);
	}
}

<?php

/**
 * GridField config necessary for managing a SiteTree object.
 *
 * @package silverstripe
 * @subpackage blog
 *
 * @author Michael Strong <github@michaelstrong.co.uk>
**/
class GridFieldConfig_BlogPost extends GridFieldConfig_Lumberjack {

	public function __construct($itemsPerPage = null) {
		parent::__construct($itemsPerPage);
		$this->removeComponentsByType('SiteTreeEditButton');
		$this->addComponent(new GridFieldSiteTreeEditButton());
	}
}

FIX GridField state was being removed when the config was removed


<?php namespace Controllers;

/**
 *This class loads the purchase history for all user types.
 *@author Geoffrey Oliver <geoffrey.oliver2@gmail.com>
 *@copyright 2015 - 2020 Geoffrey Oliver
 *@category Marketplace
 *@package Marketplace\Controllers\Home
 *@link mobeoffice.com
 */

use Helpers\View;

class HomeController extends BaseController {

	/**
	 *This method loads the homepage
	 *
	 *@param null
	 *@return void
	 */
	public function getIndex()
	{
		//get the ending date today
		View::render('index');

	}

}

<?php namespace Controllers;

/**
 *This class loads the purchase history for all user types.
 *@author Geoffrey Oliver <geoffrey.oliver2@gmail.com>
 *@copyright 2015 - 2020 Geoffrey Oliver
 *@category Marketplace
 *@package Marketplace\Controllers\Home
 *@link mobeoffice.com
 */

use Helpers\View;

class HomeController extends BaseController {

	/**
	 *This method loads the homepage
	 *
	 *@param null
	 *@return void
	 */
	public function index()
	{
		//get the ending date today
		View::render('index');

	}

}

Modify the controller default mehtod and view file ffor testing purposes


<?php

namespace TelcoLAB\MyKad;

use Illuminate\Support\ServiceProvider;

class MyKadServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}

<?php

namespace TelcoLAB\MyKad;

use Illuminate\Support\Collection;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
use TelcoLAB\MyKad\Validations\Validator;

class MyKadServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        $this->extendValidation(Validator::class);
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }

    public function extendValidation($class)
    {
        $classes = is_array($class) ? $class : [$class];

        foreach ($classes as $class) {
            if (class_exists($class) && $methods = get_class_methods($class)) {
                $validations = Collection::make($methods)->reduce(function ($filtered, $item) {
                    if (Str::startsWith($item, 'validate')) {
                        $filtered[$item] = Str::snake($strip = str_replace('validate', '', $item));
                    }
                    return $filtered;
                });

                foreach ($validations as $methodName => $validationName) {
                    $this->app->validator->extend($validationName, $class . '@' . $methodName);
                }
            }
        }
    }
}

Add extender for the methods.

Add extender for the methods.


<?php namespace Anomaly\PagesModule\Page\Command;

use Anomaly\PagesModule\Page\Contract\PageInterface;
use Anomaly\PagesModule\Page\PageTranslationsModel;

/**
 * Class SetPath
 *
 * @link   http://pyrocms.com/
 * @author PyroCMS, Inc. <support@pyrocms.com>
 * @author Ryan Thompson <ryan@pyrocms.com>
 */
class SetPath
{

    /**
     * The page translation instance.
     *
     * @var PageTranslationsModel
     */
    protected $translation;

    /**
     * Create a new SetPath instance.
     *
     * @param PageTranslationsModel $translation
     */
    public function __construct(PageTranslationsModel $translation)
    {
        $this->translation = $translation;
    }

    /**
     * Handle the command.
     */
    public function handle()
    {
        /* @var PageInterface $page */
        $page = $this->translation->getParent();

        if ($parent = $page->getParent()) {
            $path = ($parent->isHome()
                    ? $parent->translate($this->translation->getLocale())->slug
                    : $parent->translate($this->translation->getLocale())->path
                ) . '/' . $this->translation->slug;
        } elseif ($page->isHome()) {
            $path = '/';
        } else {
            $path = '/' . $this->translation->slug;
        }

        $this->translation->setAttribute('path', $path);
    }
}

<?php namespace Anomaly\PagesModule\Page\Command;

use Anomaly\PagesModule\Page\Contract\PageInterface;
use Anomaly\PagesModule\Page\PageTranslationsModel;

/**
 * Class SetPath
 *
 * @link   http://pyrocms.com/
 * @author PyroCMS, Inc. <support@pyrocms.com>
 * @author Ryan Thompson <ryan@pyrocms.com>
 */
class SetPath
{

    /**
     * The page translation instance.
     *
     * @var PageTranslationsModel
     */
    protected $translation;

    /**
     * Create a new SetPath instance.
     *
     * @param PageTranslationsModel $translation
     */
    public function __construct(PageTranslationsModel $translation)
    {
        $this->translation = $translation;
    }

    /**
     * Handle the command.
     */
    public function handle()
    {
        /* @var PageInterface $page */
        $page = $this->translation->getParent();

        if ($parent = $page->getParent()) {
            $path = ($parent->isHome()
                    ? $parent->translate($this->translation->getLocale(), true)->slug
                    : $parent->translate($this->translation->getLocale(), true)->path
                ) . '/' . $this->translation->slug;
        } elseif ($page->isHome()) {
            $path = '/';
        } else {
            $path = '/' . $this->translation->slug;
        }

        $this->translation->setAttribute('path', $path);
    }
}

Allow fallback translation for page path


<?php

/**
 * This script deletes old notifications.
 *
 * Notifications must be dismissed as quickly as possible in order to prevent
 * the ncenterlite_notify table from becoming too large. For best performance,
 * you should run this script at least once every few days.
 */
require_once __DIR__ . '/common.php';

// Delete notifications older than this number of days.
$days = 30;

// Initialize the exit status.
$exit_status = 0;

// Execute the query.
$args = new stdClass;
$args->old_date = date('YmdHis', time() - ($days * 86400));
$output = executeQuery('ncenterlite.deleteNotifyAll', $args);
if ($output->toBool())
{
	echo "Successfully deleted all notifications older than $days days.\n";
}
else
{
	echo "Error while deleting notifications older than $days days.\n";
	echo $output->getMessage() . "\n";
	$exit_status = 11;
}

// Set the exit status if there were any errors.
if ($exit_status != 0)
{
	exit($exit_status);
}

<?php

/**
 * This script deletes old notifications.
 *
 * Notifications must be dismissed as quickly as possible in order to prevent
 * the ncenterlite_notify table from becoming too large. For best performance,
 * you should run this script at least once every few days.
 */
require_once __DIR__ . '/common.php';

// Delete notifications older than this number of days.
$days = 30;

// Initialize the exit status.
$exit_status = 0;

// Execute the query.
$args = new stdClass;
$args->old_date = date('YmdHis', time() - ($days * 86400));
$output = executeQuery('ncenterlite.deleteNotifyAll', $args);
if ($output->toBool())
{
	echo "Successfully deleted all notifications older than $days days.\n";
	$delete_obj = (object)array('regdate' => time());
	Rhymix\Framework\Cache::clearGroup('ncenterlite');
	Rhymix\Framework\Storage::writePHPData(\RX_BASEDIR . 'files/cache/ncenterlite/new_notify/delete_date.php', $delete_obj);
}
else
{
	echo "Error while deleting notifications older than $days days.\n";
	echo $output->getMessage() . "\n";
	$exit_status = 11;
}

// Set the exit status if there were any errors.
if ($exit_status != 0)
{
	exit($exit_status);
}

Clear ncenterlite cache data after deleting old notifications


<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddZerofillToSettings extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('settings', function (Blueprint $table) {
            $table->integer('zerofill_count')->default(0);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('settings', function ($table) {
            $table->dropColumn('zerofill_count');
        });
    }
}

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddZerofillToSettings extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('settings', function (Blueprint $table) {
            $table->integer('zerofill_count')->default(5);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('settings', function ($table) {
            $table->dropColumn('zerofill_count');
        });
    }
}

Change default zerofill to 5

Change default zerofill to 5


<?php

require_once '/home/sites/phighcharts/poc/UniversalClassLoader.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;

$loader = new UniversalClassLoader();
$loader->register();

$loader->registerNamespaces(array(
    'Phighchart' => __DIR__.'/../classes'
));

<?php

require_once __DIR__.'/../poc/UniversalClassLoader.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;

$loader = new UniversalClassLoader();
$loader->register();

$loader->registerNamespaces(array(
    'Phighchart' => __DIR__.'/../classes'
));

Change to use relative class loader require... stupid mistake!


<?php
define('PHPUNIT_RUN', 1);

$configDir = getenv('CONFIG_DIR');
if ($configDir) {
	define('PHPUNIT_CONFIG_DIR', $configDir);
}

if (!defined('HHVM_VERSION')) {
	if(version_compare(phpversion(), '5.6.0', '>=') &&
		ini_get('always_populate_raw_post_data') !== '-1') {
		throw new Exception("'always_populate_raw_post_data' has to be set to '-1' in your php.ini");
	}
}

require_once __DIR__ . '/../lib/base.php';

// load minimum set of apps
OC_App::loadApps(array('authentication'));
OC_App::loadApps(array('filesystem', 'logging'));

if (!class_exists('PHPUnit_Framework_TestCase')) {
	require_once('PHPUnit/Autoload.php');
}

OC_Hook::clear();
OC_Log::$enabled = false;

<?php
define('PHPUNIT_RUN', 1);

$configDir = getenv('CONFIG_DIR');
if ($configDir) {
	define('PHPUNIT_CONFIG_DIR', $configDir);
}

require_once __DIR__ . '/../lib/base.php';

// load minimum set of apps
OC_App::loadApps(array('authentication'));
OC_App::loadApps(array('filesystem', 'logging'));

if (!class_exists('PHPUnit_Framework_TestCase')) {
	require_once('PHPUnit/Autoload.php');
}

OC_Hook::clear();
OC_Log::$enabled = false;

Remove check for RAW_POPULATE_POST_DATA for unit tests

We do have a work around meanwhile and for CLI this is not relevant at all. Can be removedWe do have a work around meanwhile and for CLI this is not relevant at all. Can be removed.


<?php
session_start();
require_once('config.php');
if ($_COOKIE['surveyok'] and $_SESSION['surveyok']){
  echo "The survey will be completed. Please wait the redirecting.. ";
  setcookie('surveyok',null);
  if (unset($_SESSION['surveyok']) && !$_COOKIE['surveyok']){
    header('refresh: 5; URL='.$survey_continue);
  } else {
    echo "UNSETTING ERROR (400x) - Please retry again";
  }
}
?>

<?php
session_start();
require_once('config.php');
if ($_COOKIE['surveyok'] and $_SESSION['surveyok']){
  echo "The survey will be completed. Please wait the redirecting.. ";
  setcookie('surveyok',null);
  if (unset($_SESSION['surveyok']) && !$_COOKIE['surveyok']){
    header('refresh: 5; URL='.$survey_continue);
  } else {
    echo "UNSETTING ERROR (400x) - Please retry again";
  }
} else {
  echo "The survey are not be completed. Please select another survey. ";
}
?>
<br>This software use RamondettiDavide Tracking

Verify if the surveys will be completed

Verify if the surveys will be completed


<?php
register_module([
	"name" => "Redirect pages",
	"version" => "0.1",
	"author" => "Starbeamrainbowlabs",
	"description" => "Adds support for redirect pages. Uses the same syntax that Mediawiki does.",
	"id" => "feature-redirect",
	"code" => function() {
		register_save_preprocessor(function(&index_entry, &$pagedata) {
			$matches = [];
			if(preg_match("/^# ?REDIRECT ?\[\[([^\]]+)\]\]/i", $pagedata) === 1)
			{
				// We have found a redirect page!
				// Update the metadata to reflect this.
				$index_entry->redirect = true;
				$index_entry->redirect_target = $matches[1];
			}
			else
			{
				// This page isn't a redirect. Unset the metadata just in case.
				if(isseet($index_entry->redirect))
					unset($index_entry->redirect);
				if(isseet($index_entry->redirect_target))
					unset($index_entry->redirect_target);
			}
		});
	}
]);

?>

Add (untested) redirect page backend

Add (untested) redirect page backend


<?php

namespace AppBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class StartpageController extends Controller
{
    /**
     * @Route("/", name="startpage")
     */
    public function indexAction(Request $request)
    {
        // replace this example code with whatever you need
        return $this->render('startpage/index.html.twig', ['type' => 'startpage']);
    }
}

<?php

namespace AppBundle\Controller;

use AppBundle\Controller\API\Listing\OverviewController;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class StartpageController extends Controller
{
    /**
     * @Route("/", name="startpage")
     */
    public function indexAction(Request $request)
    {
        $oc = $this->get('app.api.listing.overview');
        $overview = $oc->execute('1.0');

        return $this->render('startpage/index.html.twig', ['type' => 'startpage', 'overview' => $overview, 'title' => 'Welcome']);
    }
}

Call listing/overview service from startpage


<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Serializer\Extractor;

use Symfony\Component\PropertyInfo\PropertyListExtractorInterface;

/**
 * @author David Maicher <mail@dmaicher.de>
 *
 * @experimental in 4.3
 */
final class ObjectPropertyListExtractor implements ObjectPropertyListExtractorInterface
{
    private $propertyListExtractor;
    private $objectClassResolver;

    public function __construct(PropertyListExtractorInterface $propertyListExtractor, ?callable $objectClassResolver = null)
    {
        $this->propertyListExtractor = $propertyListExtractor;
        $this->objectClassResolver = $objectClassResolver;
    }

    /**
     * {@inheritdoc}
     */
    public function getProperties($object, array $context = []): ?array
    {
        $class = $this->objectClassResolver ? ($this->objectClassResolver)($object) : \get_class($object);

        return $this->propertyListExtractor->getProperties($class, $context);
    }
}

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Serializer\Extractor;

use Symfony\Component\PropertyInfo\PropertyListExtractorInterface;

/**
 * @author David Maicher <mail@dmaicher.de>
 *
 * @experimental in 4.3
 */
final class ObjectPropertyListExtractor implements ObjectPropertyListExtractorInterface
{
    private $propertyListExtractor;
    private $objectClassResolver;

    public function __construct(PropertyListExtractorInterface $propertyListExtractor, callable $objectClassResolver = null)
    {
        $this->propertyListExtractor = $propertyListExtractor;
        $this->objectClassResolver = $objectClassResolver;
    }

    /**
     * {@inheritdoc}
     */
    public function getProperties($object, array $context = []): ?array
    {
        $class = $this->objectClassResolver ? ($this->objectClassResolver)($object) : \get_class($object);

        return $this->propertyListExtractor->getProperties($class, $context);
    }
}

Fix CS regarding nullable arguments

Fix CS regarding nullable arguments


<?php

final class Link {
    private $_href;
    private $_text;
    private $_isExternal;
    private $_classes;

    private function __construct($text, $href, $isExternal, $classes) {
        $this->_text = $text;
        $this->_href = $href;
        $this->_isExternal = $isExternal;
        $this->_classes = $classes;
    }

    public final static function internal($text, $href) {
        return new Link($text, $href, false, '');
    }

    public final static function external($text, $href) {
        return new Link($text, $href, true, '');
    }

    public final function withClasses($classes) {
        return new Link($this->_text, $this->_href, $this->_isExternal, $classes);
    }

    public final function __toString() {
        $text = $this->_text;

        if ($this->_isExternal) {
            $text .= ' ';
        }
        return '_classes . '" href="' . $this->_href . '">' . $text . '';
    }

}

<?php

final class Link {
    private $_href;
    private $_text;
    private $_isExternal;
    private $_classes;

    private function __construct($text, $href, $isExternal, $classes) {
        $this->_text = $text;
        $this->_href = $href;
        $this->_isExternal = $isExternal;
        $this->_classes = $classes;
    }

    public final static function internal($text, $href) {
        return new Link($text, $href, false, '');
    }

    public final static function external($text, $href) {
        return new Link($text, $href, true, '');
    }

    public final function withClasses($classes) {
        return new Link($this->_text, $this->_href, $this->_isExternal, $classes);
    }

    public final function __toString() {
        $text = $this->_text;

        $attributes = array (
            'class' => $this->_classes,
            'href' => $this->_href
        );

        if ($this->_isExternal) {
            $text .= ' ';
            $attributes['target'] = '_blank';
        }

        $aAttributes = '';
        foreach ($attributes as $attribute => $value) {
            $aAttributes .= " {$attribute}=\"{$value}\"";
        }

        return '' . $text . '';
    }

}

Add target="_blank" to external links

Add target="_blank" to external links


<?php

use PushOver\Model\Response;

class ResponseTest extends PHPUnit_Framework_TestCase
{
    /**
     * @var array
     */
    protected $data = null;

    protected function setUp()
    {
        $this->data = json_decode(
            file_get_contents('./tests/_data/responses.json')
        );
    }

    public function testResponseConstructor()
    {
        foreach ($this->data->success as $vals)
        {
            $resp = new Response(
                $vals
            );
            $this->assertEquals(
                Response::STATUS_OK,
                $resp->getStatus()
            );
            $this->assertNull(
                $resp->getErrors()
            );
            $this->assertEquals(
                $vals->request,
                $resp->getRequest()
            );
        }
    }

    public function testErrorResponses()
    {
        foreach ($this->data->error as $vals)
        {
            $resp = new Response(
                $vals
            );
            $this->assertNotEquals(
                Response::STATUS_OK,
                $resp->getStatus()
            );
        }
    }
}

<?php

use PushOver\Model\Response;

class ResponseTest extends PHPUnit_Framework_TestCase
{
    /**
     * @var array
     */
    protected $data = null;

    protected function setUp()
    {
        $this->data = json_decode(
            file_get_contents('./tests/_data/responses.json')
        );
    }

    public function testResponseConstructor()
    {
        foreach ($this->data->success as $vals)
        {
            $resp = new Response(
                $vals
            );
            $this->assertEquals(
                Response::STATUS_OK,
                $resp->getStatus()
            );
            $this->assertNull(
                $resp->getErrors()
            );
            $this->assertEquals(
                $vals->request,
                $resp->getRequest()
            );
            $this->assertEmpty(
                $resp->getErrors()
            );
        }
    }

    public function testErrorResponses()
    {
        foreach ($this->data->error as $vals)
        {
            $resp = new Response(
                $vals
            );
            $this->assertNotEquals(
                Response::STATUS_OK,
                $resp->getStatus()
            );
            $this->assertNotEmpty(
                $resp->getErrors()
            );
            $this->assertEquals(
                $vals->request,
                $resp->getRequest()
            );
            if (isset($vals->user))
            {
                $this->assertEquals(
                    $vals->user,
                    $resp->getUser()
                );
            }
        }
    }
}

Test response object for error responses comming back...


<?php

namespace Project\AppBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class PromotionType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('startDate', 'date', array(
                'label' => 'Date de début',
            ))
            ->add('endDate', 'date', array(
                'label' => 'Date de fin',
            ));
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Project\AppBundle\Entity\Promotion'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'project_appbundle_promotion';
    }
}

<?php

namespace Project\AppBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class PromotionType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('formation', 'entity', array(
                                               'label' => 'Formation :',
                                               'class' => 'ProjectAppBundle:Formation',
                                               'property' => 'name'
            ))
            ->add('startDate', 'date', array(
                'label' => 'Date de début',
            ))
            ->add('endDate', 'date', array(
                'label' => 'Date de fin',
            ));
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Project\AppBundle\Entity\Promotion'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'project_appbundle_promotion';
    }
}

Add formation to the promotion form

Add formation to the promotion form


<?php

namespace AppBundle\Controller;

use AppBundle\Entity\Note;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;

class NoteController extends Controller
{
    /**
     * @Route("/note")
     */
    public function indexAction()
    {
      $notes = $this->getDoctrine()
            ->getRepository('AppBundle:Note')
            ->findAll();

        return $this->render(
            'note/index.html.twig',
            array('notes' => $notes)
        );
    }

    /**
     * @Route("/note/{id}")
     * @ParamConverter("note", class="AppBundle:Note")
    */
    public function showAction(Note $note)
    {
    }
}

<?php

namespace AppBundle\Controller;

use AppBundle\Entity\Note;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;

class NoteController extends Controller
{
    /**
     * @Route("/note")
     */
    public function indexAction()
    {
      $notes = $this->getDoctrine()
            ->getRepository('AppBundle:Note')
            ->findAll();

        return $this->render(
            'note/index.html.twig',
            array('notes' => $notes)
        );
    }

    /**
     * @Route("/note/{id}")
     * @ParamConverter("note", class="AppBundle:Note")
    */
    public function showAction(Note $note)
    {
    }

    /**
     * @Route("/note/create")
    */
    public function createAction()
    {
      $note = new Note();
      $note->setContent('My very first note');

      $em = $this->getDoctrine()->getManager();

      $em->persist($note);
      $em->flush();

      return new Response('Created note id '.$note->getId());
    }
}

Add note createAction with sample data

Add note createAction with sample data


<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Security\Http;

final class SecurityEvents
{
    /**
     * The INTERACTIVE_LOGIN event occurs after a user has actively logged
     * into your website. It is important to distinguish this action from
     * non-interactive authentication methods, such as:
     *   - authentication based on your session.
     *   - authentication using a HTTP basic or HTTP digest header.
     *
     * @Event("Symfony\Component\Security\Http\Event\InteractiveLoginEvent")
     */
    const INTERACTIVE_LOGIN = 'security.interactive_login';

    /**
     * The SWITCH_USER event occurs before switch to another user and
     * before exit from an already switched user.
     *
     * @Event("Symfony\Component\Security\Http\Event\SwitchUserEvent")
     */
    const SWITCH_USER = 'security.switch_user';
}

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Security\Http;

use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
use Symfony\Component\Security\Http\Event\SwitchUserEvent;

final class SecurityEvents
{
    /**
     * The INTERACTIVE_LOGIN event occurs after a user has actively logged
     * into your website. It is important to distinguish this action from
     * non-interactive authentication methods, such as:
     *   - authentication based on your session.
     *   - authentication using a HTTP basic or HTTP digest header.
     *
     * @Event("Symfony\Component\Security\Http\Event\InteractiveLoginEvent")
     */
    const INTERACTIVE_LOGIN = 'security.interactive_login';

    /**
     * The SWITCH_USER event occurs before switch to another user and
     * before exit from an already switched user.
     *
     * @Event("Symfony\Component\Security\Http\Event\SwitchUserEvent")
     */
    const SWITCH_USER = 'security.switch_user';

    /**
     * Event aliases.
     *
     * These aliases can be consumed by RegisterListenersPass.
     */
    const ALIASES = [
        InteractiveLoginEvent::class => self::INTERACTIVE_LOGIN,
        SwitchUserEvent::class => self::SWITCH_USER,
    ];
}

Move event alias mappings to their components.


<?php
namespace Oro\Bundle\IntegrationBundle\Async;

class Topics
{
    const SYNC_INTEGRATION = 'oro_integration.sync_integration';

    const REVERS_SYNC_INTEGRATION = 'oro_integration.revers_sync_integration';
}

<?php
namespace Oro\Bundle\IntegrationBundle\Async;

class Topics
{
    const SYNC_INTEGRATION = 'integration.sync_integration';

    const REVERS_SYNC_INTEGRATION = 'oro.integration.revers_sync_integration';
}

CRM-5838: Migrate integration's logic from JMSJobQueue to message queue

 - Fixing topics names


<?php
namespace Muffin\Tags\Model\Table;

use Cake\ORM\Table;

class TaggedTable extends Table
{

    /**
     * Initialize table config.
     *
     * @param array $config Config options
     * @return void
     */
    public function initialize(array $config)
    {
        $this->table('tags_tagged');
    }
}

<?php
namespace Muffin\Tags\Model\Table;

use Cake\ORM\Table;

class TaggedTable extends Table
{

    /**
     * Initialize table config.
     *
     * @param array $config Config options
     * @return void
     */
    public function initialize(array $config)
    {
        $this->table('tags_tagged');
        $this->belongsTo('Tags', [
            'className' => 'Muffin/Tags.Tags',
            'foreignKey' => 'tag_id',
            'propertyName' => 'tags',
        ]);
    }
}

Add the association 'Tagged' belongs to 'Tags'


<?php
/*
 * WellCommerce Open-Source E-Commerce Platform
 *
 * This file is part of the WellCommerce package.
 *
 * (c) Adam Piotrowski <adam@wellcommerce.org>
 *
 * For the full copyright and license information,
 * please view the LICENSE file that was distributed with this source code.
 */

namespace WellCommerce\Bundle\ReviewBundle\Tests\Manager;

use WellCommerce\Bundle\CoreBundle\Test\Manager\AbstractManagerTestCase;

/**
 * Class ReviewManagerTest
 *
 * @author  Adam Piotrowski <adam@wellcommerce.org>
 */
class ReviewManagerTest extends AbstractManagerTestCase
{
    protected function get()
    {
        return $this->container->get('review.manager');
    }
}

<?php
/*
 * WellCommerce Open-Source E-Commerce Platform
 *
 * This file is part of the WellCommerce package.
 *
 * (c) Adam Piotrowski <adam@wellcommerce.org>
 *
 * For the full copyright and license information,
 * please view the LICENSE file that was distributed with this source code.
 */

namespace WellCommerce\Bundle\ReviewBundle\Tests\Manager;

use WellCommerce\Bundle\CoreBundle\Test\Manager\AbstractManagerTestCase;
use WellCommerce\Bundle\DoctrineBundle\Manager\ManagerInterface;

/**
 * Class ReviewManagerTest
 *
 * @author  Adam Piotrowski <adam@wellcommerce.org>
 */
class ReviewManagerTest extends AbstractManagerTestCase
{
    protected function get() : ManagerInterface
    {
        return $this->container->get('review.manager');
    }
}

Return types in manager tests

Return types in manager tests


<?php

namespace Grace\Test\ORM;

use Grace\ORM\ClassNameProvider;

class ClassNameProviderTest extends \PHPUnit_Framework_TestCase
{
    /** @var ClassNameProvider */
    protected $provider;

    public function testDefaultNames()
    {
        $provider = new ClassNameProvider();
        $this->assertEquals('Post', $provider->getBaseClass('\\Model\\Post'));
        $this->assertEquals('\\Model\\Post', $provider->getModelClass('Post'));
        $this->assertEquals('\\Finder\\PostFinder', $provider->getFinderClass('Post'));
        $this->assertEquals('\\Mapper\\PostMapper', $provider->getMapperClass('Post'));
        $this->assertEquals('\\Collection\\PostCollection', $provider->getCollectionClass('Post'));
    }
    public function testCommonNamespace()
    {
        $provider = new ClassNameProvider('Some\\AppBundle');
        $this->assertEquals('Post', $provider->getBaseClass('\\Some\\AppBundle\\Model\\Post'));
        $this->assertEquals('\\Some\\AppBundle\\Model\\Post', $provider->getModelClass('Post'));
        $this->assertEquals('\\Some\\AppBundle\\Finder\\PostFinder', $provider->getFinderClass('Post'));
        $this->assertEquals('\\Some\\AppBundle\\Mapper\\PostMapper', $provider->getMapperClass('Post'));
        $this->assertEquals('\\Some\\AppBundle\\Collection\\PostCollection', $provider->getCollectionClass('Post'));
    }
}

<?php

namespace Grace\Test\ORM;

use Grace\ORM\ClassNameProvider;

class ClassNameProviderTest extends \PHPUnit_Framework_TestCase
{
    /** @var ClassNameProvider */
    protected $provider;

    public function testDefaultNames()
    {
        $provider = new ClassNameProvider();
        $this->assertEquals('Post', $provider->getBaseClass('\\Model\\Post'));
        $this->assertEquals('\\Model\\Post', $provider->getModelClass('Post'));
        $this->assertEquals('\\Finder\\PostFinder', $provider->getFinderClass('Post'));
        $this->assertEquals('\\Mapper\\PostMapper', $provider->getMapperClass('Post'));
        $this->assertEquals('\\Collection\\PostCollection', $provider->getCollectionClass('Post'));
    }
    public function testCommonNamespace()
    {
        $provider = new ClassNameProvider('Some\\AppBundle');
        $this->assertEquals('Post', $provider->getBaseClass('\\Some\\AppBundle\\Model\\Post'));
        $this->assertEquals('\\Some\\AppBundle\\Model\\Post', $provider->getModelClass('Post'));
        $this->assertEquals('\\Some\\AppBundle\\Finder\\PostFinder', $provider->getFinderClass('Post'));
        $this->assertEquals('\\Some\\AppBundle\\Mapper\\PostMapper', $provider->getMapperClass('Post'));
        $this->assertEquals('\\Some\\AppBundle\\Collection\\PostCollection', $provider->getCollectionClass('Post'));

        $this->assertEquals('\\Some\\AppBundle\\Finder\\Post\\ExtraPostFinder', $provider->getFinderClass('Post\\ExtraPost'));
    }
}

Test extra-finder class name provider

Test extra-finder class name provider


<?php
namespace Api\V8\JsonApi\Helper;

use Api\V8\Helper\VarDefHelper;
use Api\V8\JsonApi\Response\LinksResponse;
use Api\V8\JsonApi\Response\RelationshipResponse;

class RelationshipObjectHelper
{
    /**
     * @var VarDefHelper
     */
    private $varDefHelper;

    /**
     * @param VarDefHelper $varDefHelper
     */
    public function __construct(VarDefHelper $varDefHelper)
    {
        $this->varDefHelper = $varDefHelper;
    }

    /**
     * @param \SugarBean $bean
     * @param string $uriPath
     *
     * @return RelationshipResponse
     */
    public function getRelationships(\SugarBean $bean, $uriPath)
    {
        $relationships = $this->varDefHelper->getAllRelationships($bean);
        asort($relationships);

        $relationshipsLinks = [];
        foreach (array_unique($relationships) as $module) {
            $linkResponse = new LinksResponse();
            $linkResponse->setRelated(
                sprintf('/%s/%s/%s', $uriPath, 'relationships', strtolower($module))
            );

            $relationshipsLinks[$module] = ['links' => $linkResponse];
        }

        return new RelationshipResponse($relationshipsLinks);
    }
}

<?php
namespace Api\V8\JsonApi\Helper;

use Api\V8\Helper\VarDefHelper;
use Api\V8\JsonApi\Response\LinksResponse;
use Api\V8\JsonApi\Response\RelationshipResponse;

class RelationshipObjectHelper
{
    /**
     * @var VarDefHelper
     */
    private $varDefHelper;

    /**
     * @param VarDefHelper $varDefHelper
     */
    public function __construct(VarDefHelper $varDefHelper)
    {
        $this->varDefHelper = $varDefHelper;
    }

    /**
     * @param \SugarBean $bean
     * @param string $uriPath
     *
     * @return RelationshipResponse
     */
    public function getRelationships(\SugarBean $bean, $uriPath)
    {
        $relationships = $this->varDefHelper->getAllRelationships($bean);
        asort($relationships);

        $relationshipsLinks = [];
        foreach (array_unique($relationships) as $relationshipName => $module) {
            $linkResponse = new LinksResponse();
            $linkResponse->setRelated(
                sprintf('/%s/%s/%s', $uriPath, 'relationships', $relationshipName)
            );

            $relationshipsLinks[$module] = ['links' => $linkResponse];
        }

        return new RelationshipResponse($relationshipsLinks);
    }
}

Replace the lower case module names in the relationship links in API responses by the actual relationship identifiers


<?php

require '../vendor/autoload.php';

$config = json_decode(file_get_contents("config/config.json"), true);
$config['root'] = __DIR__;
$app = new \Slim\App([ 'settings' => $config ]);

require '../dependencies.php';

// Routes
// =============================================================
$app->get('/events', Actions\ListVisibleEventsAction::class);
$app->get('/events/{id}', Actions\GetEventAction::class);

$app->get('/eventblocks/{id}', Actions\GetEventblockAction::class);

$app->get('/reservations', Actions\ListMyReservationsAction::class);
$app->post('/reservations', Actions\CreateReservationAction::class);
$app->put('/reservations/{id}', Actions\ChangeReductionForReservationAction::class);
$app->delete('/reservations/{id}', Actions\DeleteReservationAction::class);

$app->post('/boxoffice-purchases', Actions\CreateBoxofficePurchaseAction::class);
// =============================================================

$app->run();

<?php

require '../vendor/autoload.php';

$config = json_decode(file_get_contents("config/config.json"), true);
$config['root'] = __DIR__;
$app = new \Slim\App([ 'settings' => $config ]);

require '../dependencies.php';

// Routes
// =============================================================
$app->get('/events', Actions\ListVisibleEventsAction::class);
$app->get('/events/{id}', Actions\GetEventAction::class);

$app->get('/eventblocks/{id}', Actions\GetEventblockAction::class);

$app->get('/reservations', Actions\ListMyReservationsAction::class);
$app->post('/reservations', Actions\CreateReservationAction::class);
$app->put('/reservations/{id}', Actions\ChangeReductionForReservationAction::class);
$app->delete('/reservations/{id}', Actions\DeleteReservationAction::class);

$app->get('/orders', Actions\ListOrdersAction::class);

$app->post('/boxoffice-purchases', Actions\CreateBoxofficePurchaseAction::class);
// =============================================================

$app->run();

Add list order action boxoffice endpoint


<?php

namespace Bishopm\Connexion\Http\Controllers\Auth;

use JWTAuth;
use Tymon\JWTAuth\Exceptions\JWTException;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Log;

class ApiAuthController extends Controller
{
    public function login(Request $request)
    {
        // grab credentials from the request
        $credentials = $request->only('name', 'password');
        Log::info('API login attempt: ' . $credentials);
        try {
            // attempt to verify the credentials and create a token for the user
            if (! $token = JWTAuth::attempt($credentials)) {
                return response()->json(['error' => 'invalid_credentials'], 401);
            }
        } catch (JWTException $e) {
            // something went wrong whilst attempting to encode the token
            return response()->json(['error' => 'could_not_create_token'], 500);
        }

        // all good so return the token
        return response()->json(compact('token'));
    }
}

<?php

namespace Bishopm\Connexion\Http\Controllers\Auth;

use JWTAuth;
use Tymon\JWTAuth\Exceptions\JWTException;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;

class ApiAuthController extends Controller
{
    public function login(Request $request)
    {
        // grab credentials from the request
        $credentials = $request->only('name', 'password');
        Log::info('API login attempt: ' . $credentials);
        try {
            // attempt to verify the credentials and create a token for the user
            if (! $token = JWTAuth::attempt($credentials)) {
                return response()->json(['error' => 'invalid_credentials'], 401);
            }
        } catch (JWTException $e) {
            // something went wrong whilst attempting to encode the token
            return response()->json(['error' => 'could_not_create_token'], 500);
        }

        // all good so return the token
        return response()->json(compact('token'));
    }
}

Add request to API auth

Add request to API auth


Add update information for 1.1.2-dev

Add update information for 1.1.2-dev


<?php

namespace CommerceGuys\Platform\Cli\Command;

use Symfony\Component\Console\Output\OutputInterface;

class EnvironmentActivateCommand extends EnvironmentCommand
{

    protected function configure()
    {
        $this
            ->setName('environment:activate')
            ->setDescription('Activate an environment');
        $this->addProjectOption()->addEnvironmentOption();
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        if (!$this->validateInput($input, $output)) {
            return 1;
        }

        $environmentId = $this->environment['id'];

        if (!$this->operationAllowed('activate')) {
            if (!empty($this->environment['_links']['public-url'])) {
                $output->writeln("The environment <info>$environmentId</info> is already active.");
                return 0;
            }
            $output->writeln("<error>Operation not permitted: The environment '$environmentId' can't be activated.</error>");
            return 1;
        }

        $client = $this->getPlatformClient($this->environment['endpoint']);
        $client->activateEnvironment();

        $output->writeln("The environment <info>$environmentId</info> has been activated.");
        return 0;
    }
}

<?php

namespace CommerceGuys\Platform\Cli\Command;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class EnvironmentActivateCommand extends EnvironmentCommand
{

    protected function configure()
    {
        $this
            ->setName('environment:activate')
            ->setDescription('Activate an environment');
        $this->addProjectOption()->addEnvironmentOption();
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        if (!$this->validateInput($input, $output)) {
            return 1;
        }

        $environmentId = $this->environment['id'];

        if (!$this->operationAllowed('activate')) {
            if (!empty($this->environment['_links']['public-url'])) {
                $output->writeln("The environment <info>$environmentId</info> is already active.");
                return 0;
            }
            $output->writeln("<error>Operation not permitted: The environment '$environmentId' can't be activated.</error>");
            return 1;
        }

        $client = $this->getPlatformClient($this->environment['endpoint']);
        $client->activateEnvironment();

        $output->writeln("The environment <info>$environmentId</info> has been activated.");
        return 0;
    }
}

Fix missing import for activate command.


<?php
namespace Wisembly\AmqpBundle;

use Exception;
//use RuntimeException; // to uncomment when bc is gone

use Wisembly\AmqpBundle\Exception\MessagingException as BC;

final class MessagingException extends BC
{
    public function __construct(Exception $e)
    {
        parent::__construct('There was an error while trying to use the Messaging service', $e->getCode(), $e);
    }

    public function getMessagingExceptionMessage()
    {
        return $this->getPrevious()->getMessage();
    }
}

<?php
namespace Wisembly\AmqpBundle;

use Exception;
//use RuntimeException; // to uncomment when bc is gone

use Wisembly\AmqpBundle\Exception\MessagingException as BC;

final class MessagingException extends BC
{
    public function __construct(Exception $e)
    {
        parent::__construct('There was an error while trying to use the Messaging service', $e->getCode(), $e);
    }

    /** @deprecated Use $e->getPrevious()->getMessage() instead... */
    public function getMessagingExceptionMessage()
    {
        return $this->getPrevious()->getMessage();
    }
}

Add deprecation on exception method

Add deprecation on exception method


<?php
/**
 * Created by PhpStorm.
 * User: Alex
 * Date: 14/04/2019
 * Time: 12:48
 */

namespace vr\api\components;

use vr\core\ErrorsException;

/**
 * Class ErrorHandler
 * @package vr\api\components
 */
class ErrorHandler extends \yii\web\ErrorHandler
{
    /**
     * @param \Error|\Exception $exception
     *
     * @return array
     */
    protected function convertExceptionToArray($exception)
    {
        $array = parent::convertExceptionToArray($exception);

        if ($exception instanceof ErrorsException) {
            $array += [
                'data' => $exception->data,
            ];
        }

        return $array;
    }
}

<?php
/**
 * Created by PhpStorm.
 * User: Alex
 * Date: 14/04/2019
 * Time: 12:48
 */

namespace vr\api\components;

use Error;
use Exception;
use vr\core\ErrorsException;

/**
 * Class ErrorHandler
 * @package vr\api\components
 */
class ErrorHandler extends \yii\web\ErrorHandler
{
    /**
     * @param Error|Exception $exception
     *
     * @return array
     */
    protected function convertExceptionToArray($exception)
    {
        $array = parent::convertExceptionToArray($exception);

        if ($exception instanceof ErrorsException) {
            $array += [
                'data' => $exception->data,
            ];

            if (YII_DEBUG) {
                $array += [
                    'trace' => explode("\n", $exception->getTraceAsString())
                ];
            }
        }

        return $array;
    }
}

Add trace info for debug mode on throwing an ErrorException


<?php

namespace ModuleGenerator\CLI\Console\ModuleGenerator;

use Symfony\Component\Console\Command\Command;
use ModuleGenerator\CLI\Service\ModuleGenerator\Update as UpdateService;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

final class Update extends Command
{
    /** @var UpdateService */
    protected $update;

    /**
     * @param string $name The name for this command
     */
    public function __construct(UpdateService $update)
    {
        parent::__construct();

        $this->update = $update;
    }

    protected function configure()
    {
        $this->setName('module-generator:update')
            ->setDescription('Updates the module-generator');
    }

    /**
     * @param InputInterface $input The input
     * @param OutputInterface $output The output
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->update->run();
    }
}

<?php

namespace ModuleGenerator\CLI\Console\ModuleGenerator;

use Symfony\Component\Console\Command\Command;
use ModuleGenerator\CLI\Service\ModuleGenerator\Update as UpdateService;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

final class Update extends Command
{
    /** @var UpdateService */
    protected $update;

    /**
     * @param string $name The name for this command
     */
    public function __construct(UpdateService $update)
    {
        parent::__construct();

        $this->update = $update;
    }

    protected function configure()
    {
        $this->setName('module-generator:update')
            ->setDescription('Updates the module-generator')
            ->setAliases(['self:update']);
    }

    /**
     * @param InputInterface $input The input
     * @param OutputInterface $output The output
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->update->run();
    }
}

Add alias for the update so you can run self:update


<?php

namespace Jenssegers\Agent;

use Illuminate\Support\ServiceProvider;

class AgentServiceProvider extends ServiceProvider
{
    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = false;

    /**
     * Bootstrap the application events.
     */
    public function boot()
    {
        //
    }

    /**
     * Register the service provider.
     */
    public function register()
    {
        $this->app->singleton('agent', function ($app) {
            return new Agent($app['request']->server->all());
        });
    }
}

<?php

namespace Jenssegers\Agent;

use Illuminate\Support\ServiceProvider;

class AgentServiceProvider extends ServiceProvider
{
    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = true;

    /**
     * Bootstrap the application events.
     */
    public function boot()
    {
        //
    }

    /**
     * Register the service provider.
     */
    public function register()
    {
        $this->app->singleton('agent', function ($app) {
            return new Agent($app['request']->server->all());
        });

        $this->app->alias('agent', Agent::class);
    }

    /**
     * Get the services provided by the provider.
     *
     * @return array
     */
    public function provides()
    {
        return ['agent', Agent::class];
    }
}

Make Laravel service provider deferred

Make Laravel service provider deferred


<?php
declare(strict_types=1);
namespace Onion\Framework\Http\Middleware;

use Interop\Http\Middleware\DelegateInterface;
use Interop\Http\Middleware\ServerMiddlewareInterface;
use Psr\Http\Message;

final class Delegate implements DelegateInterface
{
    /**
     * @var ServerMiddlewareInterface
     */
    protected $middleware;

    /**
     * @var Message\ResponseInterface
     */
    protected $response;

    /**
     * MiddlewareDelegate constructor.
     *
     * @param ServerMiddlewareInterface[] $middleware Middleware of the frame
     */
    public function __construct(array $middleware, Message\ResponseInterface $response = null)
    {
        $this->middleware = $middleware;
        $this->response = $response;
    }

    /**
     * @param Message\RequestInterface $request
     *
     * @throws Exceptions\MiddlewareException if returned response is not instance of ResponseInterface
     * @return Message\ResponseInterface
     */
    public function process(Message\ServerRequestInterface $request): Message\ResponseInterface
    {
        if ($this->middleware !== []) {
            $middleware = array_shift($this->middleware);

            if ($middleware !== null) {
                if (!$middleware instanceof ServerMiddlewareInterface) {
                    throw new \TypeError(
                        'All members of middleware must implement ServerMiddlewareInterface'
                    );
                }

                return $middleware->process($request, $this);
            }
        }

        if (null === $this->response) {
            throw new \RuntimeException('No response template provide');
        }

        return $this->response;
    }
}

<?php
declare(strict_types=1);
namespace Onion\Framework\Http\Middleware;

use Interop\Http\Middleware\DelegateInterface;
use Interop\Http\Middleware\ServerMiddlewareInterface;
use Psr\Http\Message;

final class Delegate implements DelegateInterface
{
    /**
     * @var ServerMiddlewareInterface
     */
    protected $middleware;

    /**
     * @var Message\ResponseInterface
     */
    protected $response;

    /**
     * MiddlewareDelegate constructor.
     *
     * @param ServerMiddlewareInterface[] $middleware Middleware of the frame
     */
    public function __construct(array $middleware, Message\ResponseInterface $response = null)
    {
        $this->middleware = $middleware;
        $this->response = $response;
    }

    /**
     * @param Message\RequestInterface $request
     *
     * @throws Exceptions\MiddlewareException if returned response is not instance of ResponseInterface
     * @return Message\ResponseInterface
     */
    public function process(Message\ServerRequestInterface $request): Message\ResponseInterface
    {
        if ($this->middleware !== []) {
            $middleware = array_shift($this->middleware);

            if ($middleware !== null) {
                assert(
                    $middleware instanceof ServerMiddlewareInterface,
                    new \TypeError('All members of middleware must implement ServerMiddlewareInterface')
                );

                return $middleware->process($request, $this);
            }
        }

        if (null === $this->response) {
            throw new \RuntimeException('No response template provided');
        }

        return $this->response;
    }
}

Change to using assert instead of if

Change to using assert instead of if


<?php
namespace Foodtrack\Controller\Provider;

use Silex\ControllerProviderInterface;
use Silex\ServiceProviderInterface;
use Silex\Application;
use Foodtrack\Controller\FoodController;

class Food implements ControllerProviderInterface, ServiceProviderInterface
{
    public function register(Application $app)
    {
        $app['foodtrack.foodcontroller'] = $app->share(function () use($app) {
            return new FoodController($app['orm.em']);
        });
    }

    public function connect(Application $app)
    {
        $controllers = $app['controllers_factory'];
        $controllers->get('/list', 'foodtrack.foodcontroller:listAction');
        return $controllers;
    }

    public function boot(Application $app) {}
}

<?php
namespace Foodtrack\Controller\Provider;

use Silex\ControllerProviderInterface;
use Silex\ServiceProviderInterface;
use Silex\Application;
use Foodtrack\Controller\FoodController;

class Food implements ControllerProviderInterface, ServiceProviderInterface
{
    public function register(Application $app)
    {
        $app['foodtrack.foodcontroller'] = $app->share(function () use($app) {
            return new FoodController($app['orm.em']);
        });
    }

    public function connect(Application $app)
    {
        $controllers = $app['controllers_factory'];
        $controllers->get('/', 'foodtrack.foodcontroller:listAction');
        return $controllers;
    }

    public function boot(Application $app) {}
}

Change route to food list to make it REST compliant


<?php defined('SYSPATH') or die('No direct script access.');

class Prophet {

    public static function exception_handler(Exception $e)
    {
        if (Kohana::$environment === Kohana::DEVELOPMENT)
        {
            Kohana_Exception::handler($e);
        }

        // It's a nice time to log :)
        Kohana::$log->add(Kohana_Log::ERROR, Kohana_Exception::text($e));

        if ( ! defined('SUPPRESS_REQUEST'))
        {
            $request = array(
                // Get status from current request
                'action'  => Request::$current->status(),

                // If exception has a message this can be passed on
                'message' => rawurlencode($e->getMessage()),
            );

            // Override status if HTTP_Exception thrown
            if ($e instanceof HTTP_Exception)
            {
                $request['action'] = $e->getCode();
            }

            echo Request::factory(Route::get('prophet_error')->uri($request))
                ->execute()
                ->send_headers()
                ->response;
        }
    }

}

<?php defined('SYSPATH') or die('No direct script access.');

class Prophet {

    public static function exception_handler(Exception $e)
    {
        if (Kohana::$environment === Kohana::DEVELOPMENT)
        {
            Kohana_Exception::handler($e);
        }

        // It's a nice time to log :)
        Kohana::$log->add(Kohana_Log::ERROR, Kohana_Exception::text($e));

        if ( ! defined('SUPPRESS_REQUEST'))
        {
            $request = array(
                // Get status from current request
                'action'  => Request::current()->status(),

                // If exception has a message this can be passed on
                'message' => rawurlencode($e->getMessage()),
            );

            // Override status if HTTP_Exception thrown
            if ($e instanceof HTTP_Exception)
            {
                $request['action'] = $e->getCode();
            }

            echo Request::factory(Route::get('prophet_error')->uri($request))
                ->execute()
                ->send_headers()
                ->response;
        }
    }

}

Update to using Request::current() method