Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Fix package tag in docblock | <?php
namespace DB\Driver;
/**
* Database driver for MYSQL using MYSQLI rather than default and deprecated
* MYSQL which is recommended by most PHP developer.
*
* @package Core
*/
class MYSQLI implements IDriver
{
private $mysqli;
public function connect($host,... | <?php
namespace DB\Driver;
/**
* Database driver for MYSQL using MYSQLI rather than default and deprecated
* MYSQL which is recommended by most PHP developer.
*
* @package DB\Driver
*/
class MYSQLI implements IDriver
{
private $mysqli;
public function connect($... |
Remove Config from AWS Credentials | <?php
require_once './config/config.php';
$credentials = new Aws\Credentials\Credentials(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY);
$config = array();
$config['region'] = AWS_REGION;
$config['credentials'] = $credentials ;
$config['version'] = 'latest'; // Or Specified
?>
| <?php
$credentials = new Aws\Credentials\Credentials(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY);
$config = array();
$config['region'] = AWS_REGION;
$config['credentials'] = $credentials ;
$config['version'] = 'latest'; // Or Specified
?>
|
Add link of an author to the credit section | <?php
if(!defined('MEDIAWIKI')) die;
$dir = __DIR__;
$ext = 'HideUnwanted';
$wgExtensionCredits['other'][] = array(
'path' => __FILE__,
'name' => $ext,
'version' => '0.1',
'author' => 'uta',
'url' => 'https://github.com/uta/HideUnwanted',
'descriptionmsg'... | <?php
if(!defined('MEDIAWIKI')) die;
$dir = __DIR__;
$ext = 'HideUnwanted';
$wgExtensionCredits['other'][] = array(
'path' => __FILE__,
'name' => $ext,
'version' => '0.1',
'author' => '[https://github.com/uta uta]',
'url' => 'https://github.com/uta/HideUnwa... |
Add sqs to list of supported drivers | <?php
return array(
/*
|--------------------------------------------------------------------------
| Default Queue Driver
|--------------------------------------------------------------------------
|
| The Laravel queue API supports a variety of back-ends via an unified
| API, giving you convenient access to e... | <?php
return array(
/*
|--------------------------------------------------------------------------
| Default Queue Driver
|--------------------------------------------------------------------------
|
| The Laravel queue API supports a variety of back-ends via an unified
| API, giving you convenient access to e... |
Make sure the destination directory can be created recursively | <?php namespace Todaymade\Daux\Format\HTML;
use Todaymade\Daux\GeneratorHelper;
trait HTMLUtils
{
public function ensureEmptyDestination($destination)
{
if (is_dir($destination)) {
GeneratorHelper::rmdir($destination);
} else {
mkdir($destination);
}
}
... | <?php namespace Todaymade\Daux\Format\HTML;
use Todaymade\Daux\GeneratorHelper;
trait HTMLUtils
{
public function ensureEmptyDestination($destination)
{
if (is_dir($destination)) {
GeneratorHelper::rmdir($destination);
} else {
mkdir($destination, 0777, true);
}... |
Make sure to test failures | <?php
namespace Tests\Shopello\API;
use \Shopello\API\ApiClient;
use \Curl\Curl;
class ApiClientTest extends \PHPUnit_Framework_TestCase
{
/** @var ApiClient */
private $target;
/** @var Curl */
private $curlMock;
public function setUp()
{
$this->curlMock = $this->getMock('Curl\Curl'... | <?php
namespace Tests\Shopello\API;
use \Shopello\API\ApiClient;
use \Curl\Curl;
class ApiClientTest extends \PHPUnit_Framework_TestCase
{
/** @var ApiClient */
private $target;
/** @var Curl */
private $curlMock;
public function setUp()
{
$this->curlMock = $this->getMock('\Curl\Curl... |
Allow moderators and admins to modify replies | <?php
namespace App\Policies;
use App\Models\Reply;
use App\User;
class ReplyPolicy
{
const CREATE = 'create';
const UPDATE = 'update';
const DELETE = 'delete';
/**
* Determine if replies can be created by the user.
*/
public function create(User $user): bool
{
// We only n... | <?php
namespace App\Policies;
use App\Models\Reply;
use App\User;
class ReplyPolicy
{
const CREATE = 'create';
const UPDATE = 'update';
const DELETE = 'delete';
/**
* Determine if replies can be created by the user.
*/
public function create(User $user): bool
{
// We only n... |
Use assertEquals() instead of assertStringEqualsFile() in order to compare XML documents with C14N | <?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\TextUI\XmlConfiguration;
use PHPUnit\Framework\T... | <?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\TextUI\XmlConfiguration;
use PHPUnit\Framework\T... |
Update comments to better explain what everything does | <?php
error_reporting(E_ALL);
require 'vendor/autoload.php';
// Get your credentials from a safe place when using in production
$username = 'your_username';
$password = 'your_password';
$domrobot = new \INWX\Domrobot();
$result = $domrobot->setLanguage('en')
// use our OTE endpoint
->useOte()
// Uncommen... | <?php
error_reporting(E_ALL);
require 'vendor/autoload.php';
// Get your credentials from a safe place when using in production
$username = 'your_username';
$password = 'your_password';
$domrobot = new \INWX\Domrobot();
$result = $domrobot->setLanguage('en')
// use the OTE endpoint
->useOte()
// or use t... |
Allow meta value to be NULL | <?php
namespace Bolt\Extension\Bolt\Members\Storage\Schema\Table;
use Bolt\Storage\Database\Schema\Table\BaseTable;
/**
* Account meta table.
*
* @author Gawain Lynch <gawain.lynch@gmail.com>
*/
class AccountMeta extends BaseTable
{
/**
* @inheritDoc
*/
protected function addColumns()
{
... | <?php
namespace Bolt\Extension\Bolt\Members\Storage\Schema\Table;
use Bolt\Storage\Database\Schema\Table\BaseTable;
/**
* Account meta table.
*
* @author Gawain Lynch <gawain.lynch@gmail.com>
*/
class AccountMeta extends BaseTable
{
/**
* @inheritDoc
*/
protected function addColumns()
{
... |
Add support for plugin pages, increase priority | <?php
/*
* This file is part of WordPlate.
*
* (c) Vincent Klaiber <hello@vinkla.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
// Remove menu items.
add_action('admin_menu', function () {
$ite... | <?php
/*
* This file is part of WordPlate.
*
* (c) Vincent Klaiber <hello@vinkla.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
// Remove menu and submenu items.
add_action('admin_menu', function (... |
Fix na edição do usuário | <?php
namespace Mixdinternet\Admix\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class EditUsersRequest extends FormRequest
{
public function rules()
{
return [
'name' => 'required|max:150'
, 'email' => 'required|email|unique:users,email,' . auth()->id()
... | <?php
namespace Mixdinternet\Admix\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class EditUsersRequest extends FormRequest
{
public function rules()
{
return [
'name' => 'required|max:150'
, 'email' => 'required|email|unique:users,email,' . request()->route()->u... |
Convert to new bindShared method on container. | <?php namespace Illuminate\Validation;
use Illuminate\Support\ServiceProvider;
class ValidationServiceProvider extends ServiceProvider {
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = true;
/**
* Register the service provider.
*
* @return... | <?php namespace Illuminate\Validation;
use Illuminate\Support\ServiceProvider;
class ValidationServiceProvider extends ServiceProvider {
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = true;
/**
* Register the service provider.
*
* @return... |
Rename wrapper to fix woocommerce conflict | <!doctype html>
<html <?php language_attributes(); ?> class="no-js" data-logo-width="<?php echo get_theme_mod('logo_width'); ?>";>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<title><?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' :'; } ?> <?php bloginfo('name'); ?></title>
<link href="//... | <!doctype html>
<html <?php language_attributes(); ?> class="no-js" data-logo-width="<?php echo get_theme_mod('logo_width'); ?>";>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<title><?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' :'; } ?> <?php bloginfo('name'); ?></title>
<link href="//... |
Fix PHP notice on notify action | <?php
/**
* @package Billing
* @copyright Copyright (C) 2012-2017 BillRun Technologies Ltd. All rights reserved.
* @license GNU Affero General Public License Version 3; see LICENSE.txt
*/
/**
* EventsNotifier action controller class
*
* @author idan
*/
class NotifyAction extends Action_B... | <?php
/**
* @package Billing
* @copyright Copyright (C) 2012-2017 BillRun Technologies Ltd. All rights reserved.
* @license GNU Affero General Public License Version 3; see LICENSE.txt
*/
/**
* EventsNotifier action controller class
*
* @author idan
*/
class NotifyAction extends Action_B... |
Update para esconder o botão de cadastrar uma vez que o usuário fizer o logon. | <?php
/* @var $this yii\web\View */
use yii\helpers\Html;
$this->title = 'Trinket';
?>
<div class="site-index">
<div class="jumbotron">
<div id="logo"><?php echo "<img src=\"image/logo.jpg\">"; ?></div>
<h1>Bem vindo a Trinket</h1>
<p class="lead">Um site feito para trocas d... | <?php
/* @var $this yii\web\View */
use yii\helpers\Html;
$this->title = 'Trinket';
?>
<div class="site-index">
<div class="jumbotron">
<div id="logo"><?php echo "<img src=\"image/logo.jpg\">"; ?></div>
<h1>Bem vindo a Trinket</h1>
<p class="lead">Um site feito para trocas d... |
Make sure modified artists cascade the album's artist_id field | <?php
use App\Models\Artist;
use Illuminate\Database\Migrations\Migration;
class CreateVariousArtists extends Migration
{
/**
* Create the "Various Artists".
*
* @return void
*/
public function up()
{
Artist::unguard();
$existingArtist = Artist::find(Artist::VARIOUS_ID... | <?php
use App\Models\Artist;
use Illuminate\Database\Migrations\Migration;
class CreateVariousArtists extends Migration
{
/**
* Create the "Various Artists".
*
* @return void
*/
public function up()
{
// Make sure modified artists cascade the album's artist_id field.
Sc... |
Change the initial bootstrap file | <?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <taylorotwell@gmail.com>
*/
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
... | <?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| First we need to get an application instance. This creates an instance
| of the application / container and bootstraps the applic... |
Allow empty strings in Match validator (set the "require" validator explicitly) | <?php
class MatchValidator extends Validator
{
public function validate()
{
$allok = true;
foreach($this->keys as $key) {
$result = preg_match($this->value, $this->model->$key);
if($result === false) {
throw new Exception('Wrong regex pattern for key ' . $key);
} elseif($result === 0) {
$allok =... | <?php
class MatchValidator extends Validator
{
public function validate()
{
$allok = true;
foreach($this->keys as $key) {
$v = $this->model->$key;
if(empty($v)) {
continue;
}
$result = preg_match($this->value, $v);
if($result === false) {
throw new Exception('Wrong regex pattern for key ' ... |
Rename theme param name for configuration resolver | <?php
namespace At\Theme\Resolver;
/**
* Class ConfigurationResolver
* @package Theme\Resolver
*/
class ConfigurationResolver implements ResolverInterface
{
/**
* @var array
*/
protected $config;
/**
* ConfigurationResolver constructor.
* @param array $config
*/
public fun... | <?php
namespace At\Theme\Resolver;
/**
* Class ConfigurationResolver
* @package Theme\Resolver
*/
class ConfigurationResolver implements ResolverInterface
{
/**
* @var array
*/
protected $config;
/**
* ConfigurationResolver constructor.
* @param array $config
*/
public fun... |
Add reconnect parms when working with ffmpeg aux | <?php
/**
* @package Scheduler
* @subpackage Conversion.engines
*/
class KConversionEngineFfmpegAux extends KJobConversionEngine
{
const FFMPEG_AUX = "ffmpeg_aux";
public function getName()
{
return self::FFMPEG_AUX;
}
public function getType()
{
return KalturaConversionEngineType::FFMPEG_AUX;
}
p... | <?php
/**
* @package Scheduler
* @subpackage Conversion.engines
*/
class KConversionEngineFfmpegAux extends KJobConversionEngine
{
const FFMPEG_AUX = "ffmpeg_aux";
public function getName()
{
return self::FFMPEG_AUX;
}
public function getType()
{
return KalturaConversionEngineType::FFMPEG_AUX;
}
p... |
Use Carbon instead of DateTime | <?php
namespace HMS\Traits\Entities;
trait SoftDeletable
{
/**
* @var \DateTime
*/
protected $deletedAt;
/**
* Sets deletedAt.
*
* @param \DateTime|null $deletedAt
*
* @return $this
*/
public function setDeletedAt(\DateTime $deletedAt = null)
{
$thi... | <?php
namespace HMS\Traits\Entities;
use Carbon\Carbon;
trait SoftDeletable
{
/**
* @var Carbon
*/
protected $deletedAt;
/**
* Sets deletedAt.
*
* @param Carbon|null $deletedAt
*
* @return $this
*/
public function setDeletedAt(Carbon $deletedAt = null)
{
... |
Add first (useful!) unit test | <?php
/**
* Test WP Password bcrypt.
*
* @package WP_Password_Bcrypt
*/
/**
* Testing class for WP Password bcrypt.
*
* @package WP_Password_Bcrypt
*/
class Tests_WP_Password_Bcrypt extends WP_UnitTestCase {
/**
* Check that constants is defined.
*/
function test_constant_defined() {
$this->assertTrue(... | <?php
/**
* Test WP Password bcrypt.
*
* @package WP_Password_Bcrypt
*/
/**
* Testing class for WP Password bcrypt.
*
* @package WP_Password_Bcrypt
*/
class Tests_WP_Password_Bcrypt extends WP_UnitTestCase {
const PASSWORD = 'password';
const HASH_BCRYPT = '$2y$10$KIMXDMJq9camkaNHkdrmcOaYJ0AT9lvovEf92yWA34sK... |
Improve exception handling of webservice | <?php
namespace fennecweb;
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json');
require_once __DIR__ . DIRECTORY_SEPARATOR . '../config.php';
if (defined('DEBUG') && DEBUG) {
error_reporting(E_ALL);
ini_set('display_... | <?php
namespace fennecweb;
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json');
require_once __DIR__ . DIRECTORY_SEPARATOR . '../config.php';
if (defined('DEBUG') && DEBUG) {
error_reporting(E_ALL);
ini_set('display_... |
Add primary key to create migrations | <?php namespace Way\Generators\Syntax;
class CreateTable extends Table {
/**
* Build string for creating a
* table and columns
*
* @param $migrationData
* @param $fields
* @return mixed
*/
public function create($migrationData, $fields)
{
$migrationData = ['metho... | <?php namespace Way\Generators\Syntax;
class CreateTable extends Table {
/**
* Build string for creating a
* table and columns
*
* @param $migrationData
* @param $fields
* @return mixed
*/
public function create($migrationData, $fields)
{
$migrationData = ['metho... |
Return something to identify file not found. | <?php
/**
* This file script is used to provide the data stored for some user
* in a server side storage.
*
* Expects an uid as a POST parameter, returns a file with that name from
* $userdatapath which has a json ending. The mime type is set accordingly.
* @uses $userdataPath
* @see getUserId.php
* ... | <?php
/**
* This file script is used to provide the data stored for some user
* in a server side storage.
*
* Expects an uid as a POST parameter, returns a file with that name from
* $userdatapath which has a json ending. The mime type is set accordingly.
* @uses $userdataPath
* @see getUserId.php
* ... |
Make MetadataCollection Model from Factory | <?php
namespace Kunnu\Dropbox\Models;
class ModelFactory
{
/**
* Make a Model Factory
* @param array $data Model Data
* @return \Kunnu\Dropbox\Models\ModelInterface
*/
public static function make(array $data = array())
{
if(isset($data['.tag']))
{
$tag = $... | <?php
namespace Kunnu\Dropbox\Models;
class ModelFactory
{
/**
* Make a Model Factory
* @param array $data Model Data
* @return \Kunnu\Dropbox\Models\ModelInterface
*/
public static function make(array $data = array())
{
if(isset($data['.tag']))
{
$tag = $... |
Fix another fatal error from SimpleTest refactoring. | <?php
generate_mock_once('HTMLPurifier_ErrorCollector');
/**
* Extended error collector mock that has the ability to expect context
*/
class HTMLPurifier_ErrorCollectorEMock extends HTMLPurifier_ErrorCollectorMock
{
private $_context;
private $_expected_context = array();
private $_expected_context... | <?php
generate_mock_once('HTMLPurifier_ErrorCollector');
/**
* Extended error collector mock that has the ability to expect context
*/
class HTMLPurifier_ErrorCollectorEMock extends HTMLPurifier_ErrorCollectorMock
{
private $_context;
private $_expected_context = array();
private $_expected_context... |
Add stack trace to api errors | <?php declare(strict_types=1);
/*.
require_module 'standard';
require_module 'json';
.*/
namespace App\Handler;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
final class ApiError extends \Slim\Handlers\Error
{
public function __invoke(Reques... | <?php declare(strict_types=1);
/*.
require_module 'standard';
require_module 'json';
.*/
namespace App\Handler;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
final class ApiError extends \Slim\Handlers\Error
{
public function __invoke(Reques... |
Handle unauthorized exceptions (do not pollute error log) | <?php
if (defined('PHAST_SERVICE')) {
$service = PHAST_SERVICE;
} else if (!isset ($_GET['service'])) {
http_response_code(404);
exit;
} else {
$service = $_GET['service'];
}
if (isset ($_GET['src']) && !headers_sent()) {
header('Location: ' . $_GET['src']);
} else {
http_response_code(404);
... | <?php
if (defined('PHAST_SERVICE')) {
$service = PHAST_SERVICE;
} else if (!isset ($_GET['service'])) {
http_response_code(404);
exit;
} else {
$service = $_GET['service'];
}
if (isset ($_GET['src']) && !headers_sent()) {
header('Location: ' . $_GET['src']);
} else {
http_response_code(404);
... |
Append or replace activities on account merge - cleanup | <?php
namespace Oro\Bundle\ActivityListBundle;
use Oro\Bundle\ActivityListBundle\DependencyInjection\Compiler\AddStrategyCompilerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Oro\Bundle\ActivityListBundle\DependencyInjection\Compiler\ActivityLis... | <?php
namespace Oro\Bundle\ActivityListBundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Oro\Bundle\ActivityListBundle\DependencyInjection\Compiler\ActivityListProvidersPass;
class OroActivityListBundle extends Bundle
{
/**
* {@inheritdo... |
Add where clause in moloquent inheritance scope | <?php namespace ThibaudDauce\MoloquentInheritance;
use Illuminate\Database\Eloquent\ScopeInterface;
use Illuminate\Database\Eloquent\Builder;
class MoloquentInheritanceScope implements ScopeInterface {
/**
* All of the extensions to be added to the builder.
*
* @var array
*/
protected $extensions = ['OnlyP... | <?php namespace ThibaudDauce\MoloquentInheritance;
use Illuminate\Database\Eloquent\ScopeInterface;
use Illuminate\Database\Eloquent\Builder;
class MoloquentInheritanceScope implements ScopeInterface {
/**
* All of the extensions to be added to the builder.
*
* @var array
*/
protected $extensions = ['OnlyP... |
Add parameter to only email output from scheduled commands if it exists | <?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return v... | <?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return v... |
FIX AL CAMPO DEL REPORTE DE PROVEEDOR - AHORA ES TIPO HIDDEN | <div class="container">
<input type="text" id="tipo_reporte" value="por_proveedor">
<div class="row">
<div class="col-sm-8 col-md-8 col-lg-8">
<label for="">Seleccione proveedor</label>
<select name="proveedor_id" id="proveedor_id" class="form-control">
@foreach(App\Models\compras\Proveedor::get() as $pro... | <div class="container">
<input type="hidden" id="tipo_reporte" value="por_proveedor">
<div class="row">
<div class="col-sm-8 col-md-8 col-lg-8">
<label for="">Seleccione proveedor</label>
<select name="proveedor_id" id="proveedor_id" class="form-control">
@foreach(App\Models\compras\Proveedor::get() as $p... |
Add getting configs for a plugin | <?php
namespace Botonomous;
use Botonomous\utility\ArrayUtility;
use Botonomous\utility\StringUtility;
/**
* Class AbstractConfig.
*/
abstract class AbstractConfig
{
protected static $configs;
/**
* @param $key
* @param array $replacements
*
* @throws \Exception
*
* @re... | <?php
namespace Botonomous;
use Botonomous\utility\ArrayUtility;
use Botonomous\utility\StringUtility;
/**
* Class AbstractConfig.
*/
abstract class AbstractConfig
{
protected static $configs;
/**
* @param $key
* @param array $replacements
*
* @throws \Exception
*
* @re... |
Use proper spinegar wrapper again. | <?php
namespace BisonLab\SugarCrmBundle\Service;
/*
* Just a service object for the sugar7crm-wrapper class.
*/
class SugarWrapper
{
private $sugar;
private $options;
public function __construct($base_url, $username, $password)
{
$this->options = array('base_url' => $base_url,
... | <?php
namespace BisonLab\SugarCrmBundle\Service;
/*
* Just a service object for the sugar7crm-wrapper class.
*/
class SugarWrapper
{
private $sugar;
private $options;
public function __construct($base_url, $username, $password)
{
$this->options = array('base_url' => $base_url,
... |
Disable load of empty services | <?php
namespace Afup\Bundle\MemberBundle\DependencyInjection;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
/**
* Loads and manages your bundle ... | <?php
namespace Afup\Bundle\MemberBundle\DependencyInjection;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
/**
* Loads and manages your bundle ... |
Fix the yield infinite loop error | <?php namespace Bkwld\LaravelHaml;
// Dependencies
use Illuminate\View\Compilers\BladeCompiler;
use Illuminate\View\Compilers\CompilerInterface;
use Illuminate\Filesystem\Filesystem;
use MtHaml\Environment;
class HamlBladeCompiler extends BladeCompiler implements CompilerInterface {
/**
* The MtHaml instance.
*... | <?php namespace Bkwld\LaravelHaml;
// Dependencies
use Illuminate\View\Compilers\BladeCompiler;
use Illuminate\View\Compilers\CompilerInterface;
use Illuminate\Filesystem\Filesystem;
use MtHaml\Environment;
class HamlBladeCompiler extends BladeCompiler implements CompilerInterface {
/**
* The MtHaml instance.
*... |
Add the ability to use a custom driver, in feature manager | <?php
namespace DataSift\Feature;
use DataSift\Feature\Driver\DriverManager;
use DataSift\Feature\Driver\Services\DriverInterface;
/**
* Class FeatureManager
*
* @package DataSift\Feature
*/
class FeatureManager
{
/**
* @var DriverInterface
*/
protected $driver;
/**
* FeatureManager c... | <?php
namespace DataSift\Feature;
use DataSift\Feature\Driver\DriverManager;
use DataSift\Feature\Driver\Services\DriverInterface;
/**
* Class FeatureManager
*
* @package DataSift\Feature
*/
class FeatureManager
{
/**
* @var DriverInterface
*/
protected $driver;
/**
* FeatureManager c... |
Add abstract performFreezen and performUnfreeze methods to trait | <?php
namespace Clippings\Freezable;
/**
* @author Haralan Dobrev <hkdobrev@gmail.com>
* @copyright 2014, Clippings Ltd.
* @license http://spdx.org/licenses/BSD-3-Clause
*/
trait FreezableTrait
{
public $isFrozen = false;
/**
* Set `isFrozen` and execute `performFreeze()`
*
* @return ... | <?php
namespace Clippings\Freezable;
/**
* @author Haralan Dobrev <hkdobrev@gmail.com>
* @copyright 2014, Clippings Ltd.
* @license http://spdx.org/licenses/BSD-3-Clause
*/
trait FreezableTrait
{
public $isFrozen = false;
/**
* Set `isFrozen` and execute `performFreeze()`
*
* @return ... |
Add get and set methods for a resource. | <?php
/**
* @package PHPUnit_Helper
*
* @author Adamo Crespi <hello@aerendir.me>
* @copyright Copyright (C) 2016.
* @license MIT
*/
namespace SerendipityHQ\Library\PHPUnit_Helper;
/**
* A PHPUnit helper to better manage tested resources, mocked objects and test values
*
* @package Serendipity... | <?php
/**
* @package PHPUnit_Helper
*
* @author Adamo Crespi <hello@aerendir.me>
* @copyright Copyright (C) 2016.
* @license MIT
*/
namespace SerendipityHQ\Library\PHPUnit_Helper;
/**
* A PHPUnit helper to better manage tested resources, mocked objects and test values
*
* @package Serendipity... |
Fix missing parameter in docs of setChannel function | <?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Component\Channel\Model;
use Sylius\Component\Resource\Model\CodeAwareInterface;
use... | <?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Component\Channel\Model;
use Sylius\Component\Resource\Model\CodeAwareInterface;
use... |
Put that editor in a div, editors love divs. | @section('content')
<div class="container">
<div class="row">
<!-- Dummy Add post box -->
<div class="box">
<div class="col-lg-12 text-center">
<form>
<h2><span id="post-title" contenteditable="true">Test</span><br><small id="post-date">{{ \Carbon\Car... | @section('content')
<div class="container">
<div class="row">
<!-- Dummy Add post box -->
<div class="box">
<div class="col-lg-12 text-center">
<form>
<h2><span id="post-title" contenteditable="true">Test</span><br><small id="post-date">{{ \Carbon\Car... |
Fix cron, for server information update | <?php
include('../www/config.php');
include('../www/functions.php');
include('../www/libs/Db.class.php');
include('../www/libs/Socket.class.php');
include('../www/libs/Server.class.php');
include('../www/libs/Guest.class.php');
include('../www/libs/User.class.php');
include('../www/libs/Admin.class.php');
Admin::se... | <?php
include('/usr/share/vca/www/config.php');
include(PATH.'www/functions.php');
include(PATH.'www/libs/Db.class.php');
include(PATH.'www/libs/Socket.class.php');
include(PATH.'www/libs/Server.class.php');
include(PATH.'www/libs/Guest.class.php');
include(PATH.'www/libs/User.class.php');
include(PATH.'www/libs/Adm... |
Increase default timeout for shell tasks. | <?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();
... | <?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()) {
$err... |
Update to ready the blog plugin for new layout changes. | <?php
/** @var rtSitePage $rt_site_page */
use_helper('I18N', 'Date', 'rtText')
?>
<div class="rt-section rt-site-page">
<div class="rt-section-tools-header rt-admin-tools">
<?php echo link_to(__('Edit Page'), 'rtSitePageAdmin/edit?id='.$rt_site_page->getId(), array('class' => 'rt-admin-edit-tools-trigger'))... | <?php
/** @var rtSitePage $rt_site_page */
use_helper('I18N', 'Date', 'rtText')
?>
<div class="rt-section rt-site-page">
<!--RTAS
<div class="rt-section-tools-header rt-admin-tools">
<?php echo link_to(__('Edit Page'), 'rtSitePageAdmin/edit?id='.$rt_site_page->getId(), array('class' => 'rt-admin-edit-tools... |
Handle exceptions when cropping images. | <?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 $signatu... | <?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.
*
... |
FIX GridField state was being removed when the config was removed | <?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::__... | <?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) {
... |
Change default zerofill to 5 | <?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) {
... | <?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) {
... |
Change to use relative class loader require... stupid mistake! | <?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'
)); |
Move event alias mappings to their components. | <?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
{
/**
... | <?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\Ev... |
Return types in manager tests | <?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\... | <?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\... |
Replace the lower case module names in the relationship links in API responses by the actual relationship identifiers | <?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
... | <?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
... |
Add tokens and seconds as private members | <?
namespace iFixit\TokenBucket;
use \InvalidArgumentException;
/**
* Defines a rate of tokens per second. Specify the tokens you want to
* allow for a given number of seconds.
*/
class TokenRate {
private $rate;
public function __construct($tokens, $seconds) {
if (!is_int($tokens)) {
throw ... | <?
namespace iFixit\TokenBucket;
use \InvalidArgumentException;
/**
* Defines a rate of tokens per second. Specify the tokens you want to
* allow for a given number of seconds.
*/
class TokenRate {
private $rate;
private $tokens;
private $seconds;
public function __construct($tokens, $seconds) {
... |
Add a subtle gradient to the header | <section class="hero {{ $theme }}">
<div class="hero-body">
<div class="container">
<div class="columns is-mobile">
<div class="column is-3 has-text-right">
<a href="{{ url('/') }}"><img src="logo-w.svg" alt="logo" id="logo"></a>
</div>
... | <section class="hero {{ $theme }} is-bold">
<div class="hero-body">
<div class="container">
<div class="columns is-mobile">
<div class="column is-3 has-text-right">
<a href="{{ url('/') }}"><img src="logo-w.svg" alt="logo" id="logo"></a>
</div>... |
Check your damn code before you commit it. Fixes home route | <?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond ... | <?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond ... |
Replace deprecated class (since Symphony 2.6) | <?php
if (!defined('ENMDIR')) define('ENMDIR', EXTENSIONS . "/email_newsletter_manager");
if (!defined('ENVIEWS')) define('ENVIEWS', ENMDIR . "/content/templates");
class contentExtensionemail_newsletter_managerpublishfield extends AjaxPage
{
public function view()
{
$this->addHeaderToPage('Content-Ty... | <?php
if (!defined('ENMDIR')) define('ENMDIR', EXTENSIONS . "/email_newsletter_manager");
if (!defined('ENVIEWS')) define('ENVIEWS', ENMDIR . "/content/templates");
class contentExtensionemail_newsletter_managerpublishfield extends XMLPage
{
public function view()
{
$this->addHeaderToPage('Content-Typ... |
Remove image size 500, add back when accutally needed. | <?php
/**
* Load admin dependencies.
*/
$tempdir = get_template_directory();
require_once($tempdir.'/admin/init.php');
/**
* Theme set up settings.
*/
add_action('after_setup_theme', function()
{
// Configure WP 2.9+ Thumbnails.
add_theme_support('post-thumbnails');
set_post_thumbnail_size(50, 50, true);
add_... | <?php
/**
* Load admin dependencies.
*/
$tempdir = get_template_directory();
require_once($tempdir.'/admin/init.php');
/**
* Theme set up settings.
*/
add_action('after_setup_theme', function()
{
// Configure WP 2.9+ Thumbnails.
add_theme_support('post-thumbnails');
set_post_thumbnail_size(50, 50, true);
// ... |
Add blank line before "namespace" declaration keyword | <?php
/**
* @author Pierre-Henry Soria <hello@ph7cms.com>
* @copyright (c) 2019, Pierre-Henry Soria. All Rights Reserved.
* @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
* @package PH7 / App / System / Module / SMS Verification / Inc... | <?php
/**
* @author Pierre-Henry Soria <hello@ph7cms.com>
* @copyright (c) 2019, Pierre-Henry Soria. All Rights Reserved.
* @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
* @package PH7 / App / System / Module / SMS Verification / Inc... |
Add partial eta-squared effect size. | <?php
namespace MathPHP\Statistics;
/**
* Effect size is a quantitative measure of the strength of a phenomenon.
* https://en.wikipedia.org/wiki/Effect_size
*/
class EffectSize
{
/**
* η² (Eta-squared)
*
* Eta-squared describes the ratio of variance explained in the dependent
* variable by a... | <?php
namespace MathPHP\Statistics;
/**
* Effect size is a quantitative measure of the strength of a phenomenon.
* https://en.wikipedia.org/wiki/Effect_size
*/
class EffectSize
{
/**
* η² (Eta-squared)
*
* Eta-squared describes the ratio of variance explained in the dependent
* variable by a... |
Fix persisten menu command fail. | <?php
/**
* User: casperlai
* Date: 2016/9/2
* Time: 下午9:34
*/
namespace Casperlaitw\LaravelFbMessenger\Messages;
use Casperlaitw\LaravelFbMessenger\Contracts\Messages\Message;
use Casperlaitw\LaravelFbMessenger\Contracts\Messages\ThreadInterface;
use pimax\Messages\MessageButton;
/**
* Class PersistentMenuMess... | <?php
/**
* User: casperlai
* Date: 2016/9/2
* Time: 下午9:34
*/
namespace Casperlaitw\LaravelFbMessenger\Messages;
use Casperlaitw\LaravelFbMessenger\Contracts\Messages\Message;
use Casperlaitw\LaravelFbMessenger\Contracts\Messages\ThreadInterface;
/**
* Class PersistentMenuMessage
* @package Casperlaitw\Larave... |
Fix typo in environment variable name | <?php
return [
/**
* By default Glide uses the GD library. However you can also use Glide with ImageMagick
* if the Imagick PHP extension is installed.
*/
'driver' => env( 'GLIDE_DRIVER', 'gd' ),
/**
* Name of the disk where source images are stored
*/
'source_disk' => env( '... | <?php
return [
/*
* By default Glide uses the GD library. However you can also use Glide with ImageMagick
* if the Imagick PHP extension is installed.
*/
'driver' => env( 'GLIDE_DRIVER', 'gd' ),
/*
* Name of the disk where source images are stored
*/
'source_disk' => env( 'GL... |
Change how Modularity checks for ACF | <?php
namespace Modularity\Helper;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
use RecursiveRegexIterator;
use RegexIterator;
class Acf
{
public function __construct()
{
add_action('init', array($this, 'includeAcf'), 11);
add_filter('acf/settings/l10n', function () {
... | <?php
namespace Modularity\Helper;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
use RecursiveRegexIterator;
use RegexIterator;
class Acf
{
public function __construct()
{
add_action('init', array($this, 'includeAcf'), 11);
add_filter('acf/settings/l10n', function () {
... |
Correct spelling of $driver variable | <?php
/*
* This file is part of NotifyMe.
*
* (c) Joseph Cohen <joseph.cohen@dinkbit.com>
* (c) Graham Campbell <graham@mineuk.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace NotifyMeHQ\NotifyMe;
use InvalidArgum... | <?php
/*
* This file is part of NotifyMe.
*
* (c) Joseph Cohen <joseph.cohen@dinkbit.com>
* (c) Graham Campbell <graham@mineuk.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace NotifyMeHQ\NotifyMe;
use InvalidArgum... |
Fix user theme swap working when going from dark to light mode | <?php
if (!function_exists('isUsingDarkMode')) {
/**
* Check if the site should be rendered using dark mode.
*
* @return boolean
*/
function isUsingDarkMode()
{
if (request()->user() && request()->user()->theme == 'dark') {
return true;
}
return app(... | <?php
if (!function_exists('isUsingDarkMode')) {
/**
* Check if the site should be rendered using dark mode.
*
* @return boolean
*/
function isUsingDarkMode()
{
if (request()->user() && request()->user()->theme !== null) {
return request()->user()->theme == 'dark';
... |
Fix error when saving pages. | <?php namespace VotingApp\Models;
use Cviebrock\EloquentSluggable\SluggableInterface;
use Cviebrock\EloquentSluggable\SluggableTrait;
use Illuminate\Database\Eloquent\Model;
class Page extends Model implements SluggableInterface
{
use SluggableTrait;
/**
* The attributes which may be mass-assigned.
... | <?php namespace VotingApp\Models;
use Cviebrock\EloquentSluggable\SluggableInterface;
use Cviebrock\EloquentSluggable\SluggableTrait;
use Illuminate\Database\Eloquent\Model;
use Parsedown;
class Page extends Model implements SluggableInterface
{
use SluggableTrait;
/**
* The attributes which may be mas... |
Use the constant instead of demand_lib() | <?php
/**
* This file is part of the php-utils.php package.
*
* Copyright (C) 2015 Tadatoshi Tokutake <tadatoshi.tokutake@gmail.com>
*
* Licensed under the MIT License
*/
function create_path(array $dirs)
{
return array_reduce($dirs, function ($path, $dir) { return $path . $dir . DIRECTORY_SEPARATOR; }, '')... | <?php
/**
* This file is part of the php-utils.php package.
*
* Copyright (C) 2015 Tadatoshi Tokutake <tadatoshi.tokutake@gmail.com>
*
* Licensed under the MIT License
*/
function create_path(array $dirs)
{
return array_reduce($dirs, function ($path, $dir) { return $path . $dir . DIRECTORY_SEPARATOR; }, '')... |
Fix handleEvent callsite to match latest spec | <?php
declare(strict_types=1);
namespace MyVendor\MyNamespace;
use LotGD\Core\Game;
use LotGD\Core\Module as ModuleInterface;
use LotGD\Core\Models\Module as ModuleModel;
class Module implements ModuleInterface {
public static function handleEvent(Game $g, string $event, array $context) { }
public static fun... | <?php
declare(strict_types=1);
namespace MyVendor\MyNamespace;
use LotGD\Core\Game;
use LotGD\Core\Module as ModuleInterface;
use LotGD\Core\Models\Module as ModuleModel;
class Module implements ModuleInterface {
public static function handleEvent(Game $g, string $event, array &$context) { }
public static fu... |
Remove binding type local from enumeration | <?php
namespace Dkd\PhpCmis\Enum;
/**
* This file is part of php-cmis-lib.
*
* (c) Sascha Egerer <sascha.egerer@dkd.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Dkd\Enumeration\Enumeration;
/**
* Binding Type Enum.
... | <?php
namespace Dkd\PhpCmis\Enum;
/**
* This file is part of php-cmis-lib.
*
* (c) Sascha Egerer <sascha.egerer@dkd.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Dkd\Enumeration\Enumeration;
/**
* Binding Type Enum.
... |
Fix param order of assertEquals (expected, actual) in test for Finder\Glob | <?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\Finder\Tests;
use Symfony\Component\Finder\Glob;
cla... | <?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\Finder\Tests;
use Symfony\Component\Finder\Glob;
cla... |
Add a example Listener for 'nova.framework.booting' | <?php
/**
* Events - all standard Events are defined here.
*
* @author Virgil-Adrian Teaca - virgil@giulianaeassociati.com
* @version 3.0
*/
use Support\Facades\Event;
use Core\View;
use Helpers\Hooks;
use Forensics\Console;
/** Define Events. */
// Add a Listener Class to the Event 'test'.
Event::listen('test... | <?php
/**
* Events - all standard Events are defined here.
*
* @author Virgil-Adrian Teaca - virgil@giulianaeassociati.com
* @version 3.0
*/
use Support\Facades\Event;
use Core\View;
use Helpers\Hooks;
use Forensics\Console;
/** Define Events. */
// Add a Listener Class to the Event 'test'.
Event::listen('test... |
Fix issue when content is not initialized | <?php
class sfAlohaBackendDoctrine extends sfAlohaBackendAbstract
{
/**
* {@inheritdoc}
*/
public function getContentByName($name)
{
$doctrineAlohaContent = AlohaContentTable::getInstance()->findOneByName($name);
if (!$doctrineAlohaContent)
{
return null;
}
$alohaContent = new sf... | <?php
class sfAlohaBackendDoctrine extends sfAlohaBackendAbstract
{
/**
* {@inheritdoc}
*/
public function getContentByName($name)
{
$doctrineAlohaContent = AlohaContentTable::getInstance()->findOneByName($name);
if (!$doctrineAlohaContent)
{
return null;
}
$alohaContent = new sf... |
Make epsilon smaller to be able to compare smaller scores | <?php
namespace lucidtaz\minimax\engine;
use Closure;
use lucidtaz\minimax\game\Decision;
class DecisionWithScore
{
/**
* @var Decision
*/
public $decision = null;
/**
* @var float
*/
public $score;
/**
* @var integer How deep in the execution tree this result was found... | <?php
namespace lucidtaz\minimax\engine;
use Closure;
use lucidtaz\minimax\game\Decision;
class DecisionWithScore
{
const EPSILON = 0.00001;
/**
* @var Decision
*/
public $decision = null;
/**
* @var float
*/
public $score;
/**
* @var integer How deep in the execut... |
Fix in constructor of currency price tag | <?php
namespace Nilz\Money\PriceTag;
use Nilz\Money\Currency\ExchangeRate;
use Nilz\Money\MoneyInterface;
/**
* Class CurrencyPriceTag
* @author Nilz
*/
class CurrencyPriceTag extends PriceTag
{
/**
* @var ExchangeRate
*/
protected $exchangeRate;
/**
* @param MoneyInterface $netPrice
... | <?php
namespace Nilz\Money\PriceTag;
use Nilz\Money\Currency\ExchangeRate;
use Nilz\Money\MoneyInterface;
/**
* Class CurrencyPriceTag
* @author Nilz
*/
class CurrencyPriceTag extends PriceTag
{
/**
* @var ExchangeRate
*/
protected $exchangeRate;
/**
* @param MoneyInterface $netPrice
... |
Fix tests for PHP 5.3 | <?php
namespace FileNamingResolver\NamingStrategy;
use FileNamingResolver\FileInfo;
/**
* @author Victor Bocharsky <bocharsky.bw@gmail.com>
*/
class CallbackNamingStrategy extends AbstractNamingStrategy
{
/**
* @var callable
*/
protected $callback;
/**
* @param callable $callback
*... | <?php
namespace FileNamingResolver\NamingStrategy;
use FileNamingResolver\FileInfo;
/**
* @author Victor Bocharsky <bocharsky.bw@gmail.com>
*/
class CallbackNamingStrategy extends AbstractNamingStrategy
{
/**
* @var \Closure
*/
protected $callback;
/**
* @param \Closure $callback
*... |
Remove tests that targeted removed code paths in LinearLeastSquares. | <?php
use mcordingley\Regression\RegressionAlgorithm\LinearLeastSquares;
class LinearLeastSquaresTest extends PHPUnit_Framework_TestCase
{
protected $strategy;
public function __construct($name = null, array $data = array(), $dataName = '')
{
parent::__construct($name, $data, $dataName);
... | <?php
use mcordingley\Regression\RegressionAlgorithm\LinearLeastSquares;
class LinearLeastSquaresTest extends PHPUnit_Framework_TestCase
{
protected $strategy;
public function __construct($name = null, array $data = array(), $dataName = '')
{
parent::__construct($name, $data, $dataName);
... |
Validate tags() for prevent error when tags() is empty | <?php
namespace App;
use Cviebrock\EloquentSluggable\SluggableInterface;
use Cviebrock\EloquentSluggable\SluggableTrait;
use Illuminate\Database\Eloquent\Model;
class News extends Model implements SluggableInterface
{
use SluggableTrait;
protected $sluggable = [
'build_from' => 'title',
'sav... | <?php
namespace App;
use Cviebrock\EloquentSluggable\SluggableInterface;
use Cviebrock\EloquentSluggable\SluggableTrait;
use Illuminate\Database\Eloquent\Model;
class News extends Model implements SluggableInterface
{
use SluggableTrait;
protected $sluggable = [
'build_from' => 'title',
'sav... |
Create a pattern to replace with the shortcodes. | <?php
/**
* @file
* Filter that enable the use patterns to create visual content more easy.
* Drupal\visual_content_layout\Plugin\Filter\FilterVisualContent.
*
*/
namespace Drupal\visual_content_layout\Plugin\Filter;
use Drupal\filter\FilterProcessResult;
use Drupal\filter\Plugin\FilterBase;
/**
* Provides a... | <?php
/**
* @file
* Filter that enable the use patterns to create visual content more easy.
* Drupal\visual_content_layout\Plugin\Filter\FilterVisualContent.
*
*/
namespace Drupal\visual_content_layout\Plugin\Filter;
use Drupal\filter\FilterProcessResult;
use Drupal\filter\Plugin\FilterBase;
/**
* Provides a... |
Extend services… and actually return the service | <?php
namespace Bolt\Extension;
use Pimple as Container;
/**
* Storage helpers.
*
* @author Gawain Lynch <gawain.lynch@gmail.com>
*/
trait StorageTrait
{
/**
* Return a list of entities to map to repositories.
*
* <pre>
* return [
* 'alias' => [\Entity\Class\Name => \Repository... | <?php
namespace Bolt\Extension;
use Pimple as Container;
/**
* Storage helpers.
*
* @author Gawain Lynch <gawain.lynch@gmail.com>
*/
trait StorageTrait
{
/**
* Return a list of entities to map to repositories.
*
* <pre>
* return [
* 'alias' => [\Entity\Class\Name => \Repository... |
Add the config option to allow the migration | <?php
return [
/*
|--------------------------------------------------------------------------
| Use Gravatar
|--------------------------------------------------------------------------
|
| Acacha adminlte Laravel use Gravatar to obtain user's gravatars from email.
| Set this option to fals... | <?php
return [
/*
|--------------------------------------------------------------------------
| Use Gravatar
|--------------------------------------------------------------------------
|
| Acacha adminlte Laravel use Gravatar to obtain user's gravatars from email.
| Set this option to fals... |
Allow staff to use Aurora. | <?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Stripe, Mailgun, ... | <?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Stripe, Mailgun, ... |
Make sure custom thumbnails have upscaling enabled | <?php
namespace Concrete\Core\File\Image\Thumbnail\Type;
use Concrete\Core\Entity\File\Version as FileVersion;
use Concrete\Core\File\Image\Thumbnail\Type\Version as ThumbnailVersion;
use Concrete\Core\File\Image\Thumbnail\Type\Type as ThumbnailType;
class CustomThumbnail extends ThumbnailVersion
{
protected $p... | <?php
namespace Concrete\Core\File\Image\Thumbnail\Type;
use Concrete\Core\Entity\File\Version as FileVersion;
use Concrete\Core\File\Image\Thumbnail\Type\Version as ThumbnailVersion;
use Concrete\Core\File\Image\Thumbnail\Type\Type as ThumbnailType;
class CustomThumbnail extends ThumbnailVersion
{
protected $p... |
Fix typo: it is $this->storage, not just any local $storage | <?php
namespace Ob_Ivan\Cache\Driver;
use DateTime;
use Ob_Ivan\Cache\StorageInterface;
class MemoryDriver implements StorageInterface
{
const KEY_EXPIRE = __LINE__;
const KEY_VALUE = __LINE__;
/**
* @var [
* <string key> => [
* KEY_EXPIRE => <DateTime Expiration date>,
... | <?php
namespace Ob_Ivan\Cache\Driver;
use DateTime;
use Ob_Ivan\Cache\StorageInterface;
class MemoryDriver implements StorageInterface
{
const KEY_EXPIRE = __LINE__;
const KEY_VALUE = __LINE__;
/**
* @var [
* <string key> => [
* KEY_EXPIRE => <DateTime Expiration date>,
... |
Make code a little cleaner. | <?php
return function(\Slim\Slim $app, array $holeModel, array $userModel, callable $loadAuth) {
$app->get('/', $loadAuth, function() use($app, $holeModel, $userModel) {
$holes = $holeModel['find'](['visibleBy' => $app->config('codegolf.user')]);
$submissions = [];
foreach ($holes as $hole)... | <?php
return function(\Slim\Slim $app, array $holeModel, array $userModel, callable $loadAuth) {
$app->get('/', $loadAuth, function() use($app, $holeModel, $userModel) {
$user = $app->config('codegolf.user');
$holes = $holeModel['find'](['visibleBy' => $user]);
$submissions = [];
fo... |
Fix test to run under Linux CI | <?php
use Valet\PhpFpm;
use Illuminate\Container\Container;
class PhpFpmTest extends PHPUnit_Framework_TestCase
{
public function setUp()
{
$_SERVER['SUDO_USER'] = user();
Container::setInstance(new Container);
}
public function tearDown()
{
exec('rm -rf '.__DIR__.'/outp... | <?php
use Valet\PhpFpm;
use Illuminate\Container\Container;
class PhpFpmTest extends PHPUnit_Framework_TestCase
{
public function setUp()
{
$_SERVER['SUDO_USER'] = user();
Container::setInstance(new Container);
}
public function tearDown()
{
exec('rm -rf '.__DIR__.'/outp... |
Add code for PDO connects to ms sql and sqlite, fix comments. | <?php
include '_CONFIG.php';
try {
$dbh = new PDO("mysql:host=$CC_dbhost;dbname=$CC_database_name", $CC_dbusername, $CC_dbpasswd);
# MS SQL Server and Sybase with PDO_DBLIB
#$dbh = new PDO("mssql:host=$CC_dbhost;dbname=$CC_database_name, $CC_dbusername, $CC_dbpasswd");
#$dbh = new PDO("sybase:hos... | <?php
include '_CONFIG.php';
try {
$dbh = new PDO("mysql:host=$CC_dbhost;dbname=$CC_database_name", $CC_dbusername, $CC_dbpasswd);
// MS SQL Server and Sybase with PDO_DBLIB
//$dbh = new PDO("mssql:host=$CC_dbhost;dbname=$CC_database_name, $CC_dbusername, $CC_dbpasswd");
//$dbh = new PDO("sybase:... |
Clean up the MySQL database connector. | <?php namespace Laravel\Database\Connectors; use PDO;
class MySQL extends Connector {
/**
* Establish a PDO database connection for a given database configuration.
*
* @param array $config
* @return PDO
*/
public function connect($config)
{
$connection = new PDO($this->dsn($config), $config['username... | <?php namespace Laravel\Database\Connectors; use PDO;
class MySQL extends Connector {
/**
* Establish a PDO database connection for a given database configuration.
*
* @param array $config
* @return PDO
*/
public function connect($config)
{
extract($config);
// Format the initial MySQL PDO connect... |
Allow Herald rules to apply "only the first time" to Calendar events | <?php
final class PhabricatorCalendarEventHeraldAdapter extends HeraldAdapter {
private $object;
public function getAdapterApplicationClass() {
return 'PhabricatorCalendarApplication';
}
public function getAdapterContentDescription() {
return pht('React to events being created or updated.');
}
... | <?php
final class PhabricatorCalendarEventHeraldAdapter extends HeraldAdapter {
private $object;
public function getAdapterApplicationClass() {
return 'PhabricatorCalendarApplication';
}
public function getAdapterContentDescription() {
return pht('React to events being created or updated.');
}
... |
Remove create button in collection header when endpoint is database. | <h3 class="panel-title">
<span class="text-left"><?php echo ucwords(str_replace('_', ' ', ($this->response->meta->collection))); ?></span>
<?php
if ($this->m_users->get_user_permission('', $this->response->meta->collection, 'c') and $this->response->meta->collection != 'confi... | <h3 class="panel-title">
<span class="text-left"><?php echo ucwords(str_replace('_', ' ', ($this->response->meta->collection))); ?></span>
<?php
if ($this->m_users->get_user_permission('', $this->response->meta->collection, 'c') and $this->response->meta->collection != 'confi... |
Add X points to profile on task complete | <?php
namespace SayAndDo\TaskBundle\Service;
use Doctrine\ORM\EntityManager;
use SayAndDo\TaskBundle\DependencyInjection\TaskStatus;
use SayAndDo\TaskBundle\Entity\Task;
class TaskService {
protected $em;
public function __construct(EntityManager $em)
{
$this->em = $em;
}
public func... | <?php
namespace SayAndDo\TaskBundle\Service;
use Doctrine\ORM\EntityManager;
use SayAndDo\TaskBundle\DependencyInjection\TaskPoints;
use SayAndDo\TaskBundle\DependencyInjection\TaskStatus;
use SayAndDo\TaskBundle\Entity\Task;
class TaskService {
protected $em;
public function __construct(EntityManager $e... |
Remove carriage return on log script | <?php
$log_file = fopen('../../log.txt','a');
date_default_timezone_set('America/New_York');
$date = date('Y-m-d H:i:s', time());
$request_body = file_get_contents('php://input');
$log_entry = $date . " " . $request_body . "\r\n";
fwrite($log_file, $log_entry);
fclose($log_file);
echo $log_entry;
?>
| <?php
$log_file = fopen('../../log.txt','a');
date_default_timezone_set('America/New_York');
$date = date('Y-m-d H:i:s', time());
$request_body = file_get_contents('php://input');
$log_entry = $date . " " . $request_body . "\n";
fwrite($log_file, $log_entry);
fclose($log_file);
echo $log_entry;
?>
|
Fix blade extension for 5.4 | <?php
namespace Pyaesone17\ActiveState;
use Illuminate\Support\ServiceProvider;
class ActiveStateServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
\Blade::directive('activeCheck', function($expre... | <?php
namespace Pyaesone17\ActiveState;
use Illuminate\Support\ServiceProvider;
class ActiveStateServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
\Blade::directive('activeCheck', function($expre... |
Update string text domain and retab code | <section class="no-results not-found">
<header class="page-header">
<h1 class="page-title"><?php _e('Nothing Found', 'twentyseventeen'); ?></h1>
</header>
<div class="page-content">
<?php if (is_home() && current_user_can('publish_posts')) : ?>
<p><?php printf(__('Ready to publish your first post? <... | <section class="no-results not-found">
<header class="page-header">
<h1 class="page-title"><?php _e('Nothing Found', 'twentyseventeen'); ?></h1>
</header>
<div class="page-content">
<?php if (is_home() && current_user_can('publish_posts')) : ?>
<p><?php printf(__('Ready to publi... |
Add test for Credentials abstract class. | <?php
use PHPUnit\Framework\TestCase;
use Risan\OAuth1\Credentials\Credentials;
class CredentialsTest extends TestCase
{
private $credentialsStub;
function setUp()
{
$this->credentialsStub = $this->getMockForAbstractClass(Credentials::class, ['foo', 'bar']);
}
/** @test */
function c... | |
Clean up and formalize interfaces. | <?php
/**
* Guardrail. Copyright (c) 2017, Jonathan Gardiner and BambooHR.
* Apache 2.0 License
*/
namespace BambooHR\Guardrail\SymbolTable;
interface PersistantSymbolTable {
/**
* @return void
*/
public function connect();
/**
* @return void
*/
public function disconnect();
/**
* @return void
... | |
Move CleanCache commands to lib/Robo/Plugins/Commands/ | <?php
namespace SuiteCRM\Robo\Plugin\Commands;
/**
* Class CleanCacheCommands
*
* @category RoboTasks
* @package SuiteCRM\Robo\Plugin\Commands
* @author Jose C. Massón <jose@gcoop.coop>
* @license GNU GPLv3
* @link CleanCacheCommands
*/
class CleanCacheCommands extends \Robo\Tasks
{
/**
... | |
Hide lower priced subscription levels on the registration form for existing members. | <?php
/**
* This will hide subscription levels on the registration form page
* if their price is lower than the price of member's current
* subscription level.
*/
function jp_hide_lower_cost_levels( $levels ) {
if ( ! rcp_is_registration_page() || ! is_user_logged_in() ) {
return $levels;
}
$existing_sub = r... | |
Add a koala_content:setup command which creates some default content | <?php
namespace Koala\ContentBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Koala\ContentBundle\Entity\Page;
use Koala\ContentBundle\Entity\Region;
class SetupCommand extend... | |
Add tests for composite denormalizer | <?php
namespace spec\SyliusLabs\RabbitMqSimpleBusBundle\Denormalizer;
use PhpAmqpLib\Message\AMQPMessage;
use PhpSpec\ObjectBehavior;
use SyliusLabs\RabbitMqSimpleBusBundle\Denormalizer\DenormalizationFailedException;
use SyliusLabs\RabbitMqSimpleBusBundle\Denormalizer\DenormalizerInterface;
/**
* @author Kamil Kok... | |
Add Unit Tests for Utility\Algorithms | <?php
namespace TYPO3\Flow\Tests\Unit\Utility;
/* *
* This script belongs to the TYPO3 Flow framework. *
* *
* It is free software; you can redistribute... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.