This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Tests\Domain\Twitter; | |
use App\Domain\Twitter\TwitterProfile; | |
class TwitterProfileTest extends \App\Tests\BaseUnitTest | |
{ | |
private $accessToken = 'oauth-token'; | |
private $accessSecret = 'oauth-secret'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Example of a PHP class that stores dynamic properties in an array, and then can be used to create a SQL statement | |
* | |
* I would consider this a proof-of-concept and I do not believe this is a good practice | |
*/ | |
class User | |
{ | |
/** | |
* @var array Object attributes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
The question: | |
if ( $date_text == 'Sunday' ){ | |
$sql = "update table set sun = $date where "id ='$_REQUEST[num]"; | |
$sql1= "update table set sun = $date where "id ='$_REQUEST[num1]"; | |
mysql_query($con,$sql); | |
mysql_query($con,$sql1); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//FILE LOCATION: project-directory/config/bootstrap.php | |
declare(strict_types=1); | |
//Composer autoloader file | |
require_once __DIR__ . '/../vendor/autoload.php'; | |
error_reporting(E_ALL | E_NOTICE); | |
//Load the files required for configuration | |
$configuration = require __DIR__ . '/settings.php'; | |
$countyList = require __DIR__ . '/../vendor/some-other-package/list-of-tennessee-counties.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class BaseController extends Controller | |
{ | |
public function callAction($method, $params) | |
{ | |
$ajax = Request::isAjax(); | |
try { | |
return parent::callAction($method, $params); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Retrieves an environment variable from the correct environment file | |
#Based on the specified environment | |
#Example: getEnvVariable local DB_USER VARIABLE | |
#Will attempt to retrieve the DB_USER array value from the file at .env.local.php | |
#And then store the result in VARIABLE | |
getEnvVariable(){ | |
local RESULT=$3 | |
local LOCAL_RESULT=$(php -r ' | |
$file = getcwd() . "/.env." . trim($argv[1]) . ".php"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Validates a value based on its length as a string | |
* | |
* ```php | |
* $toBeValidated = 17; | |
* $validationParameters = [ | |
* 'min' => 10 | |
* ]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$SQL = "SELECT inv.*, COUNT(*) OVER() AS totalrows FROM stones inv WHERE wt >= 2.5"; | |
if (isset($_POST["ItemSearch"])) $SQL .= "AND number LIKE '" . $_POST["ItemSearch"] . "%'"; | |
if (isset($_POST["minimum_wt"], $_POST["maximum_wt"]) && !empty($_POST["minimum_wt"]) && !empty($_POST["maximum_wt"])) $SQL .= "AND wt BETWEEN '" . $_POST["minimum_wt"] . "' AND '" . $_POST["maximum_wt"] . "'"; | |
if (isset($_POST["shape"])) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class EloquenFooRepository | |
{ | |
/** | |
* The base eloquent model | |
* @var Eloquent | |
*/ | |
protected $model; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace Personly\Http\Traits; | |
use Personly\Framework\Rendering\TemplateRenderer; | |
use Symfony\Component\HttpFoundation\{JsonResponse, Response}; | |
trait RendersTemplates |