Skip to content

Instantly share code, notes, and snippets.

View chukShirley's full-sized avatar

Chuk Shirley chukShirley

  • Sure Consulting LLC
  • Alabama
View GitHub Profile
@chukShirley
chukShirley / IBMiToolkitAdapter.php
Last active August 5, 2016 15:30
Mocking the IBM i Toolkit
<?php
namespace Application;
use ToolkitApi\Toolkit;
/**
* Class IbmiToolkitAdapter
* @package Application
*/
class IbmiToolkitAdapter extends Toolkit implements IbmiToolkitInterface
<?php
call_user_func(function () {
$phpBinary = '/usr/local/zendsvr6/bin/php-cli';
$baseDirectory = getenv('ZS_APPLICATION_BASE_DIR');
$migrationLogFile = getenv('ZS_MIGRATION_LOG_FILE');
//foreach (['migrations:migrate', 'orm:generate-proxies', 'app:clear-cache'] as $operation) {
foreach (['migrations:migrate', 'app:clear-cache'] as $operation) {
$command = sprintf(
@chukShirley
chukShirley / FetchAllUnpaidLoadsQueryHandler.php
Created July 22, 2016 20:30
Mocking Zend Db Table Gateway
<?php
namespace Load\Service\Query;
use Load\Infrastructure\Persistence\LoadTable;
use ServiceBus\Query\QueryHandlerInterface;
use Zend\Db\Sql\Predicate\Operator;
use Zend\Db\Sql\Select;
/**
* Class FetchAllUnpaidLoadsQueryHandler
<?php
namespace RPG\Service\Factory;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use ToolkitApi\Toolkit;
/**
* Class ToolkitFactory
* @package RPG\Service\Factory
*/
Class CustomerRepository
{
private $customerTable;
private $customerMapper;
public function __construct(CustomerTable $customerTable, CustomerMapper $customerMapper)
{
$this->customerTable = $customerTable;
$this->CustomerMapper = $customerMapper;
}
<?php
namespace Temp;
use ToolkitApi\Toolkit;
class Dummy
{
/** @var Toolkit */
private $ibmiToolkit;
@chukShirley
chukShirley / MemberController.php
Last active February 26, 2016 21:59
DDD sample
<?php
class MemberController
{
private $memberService;
public function __construct(MemberService $memberService)
{
$this->memberService = $memberService;
}
@chukShirley
chukShirley / FileStreamer.php
Created February 15, 2016 20:06
MVC Stream an image
<?php
class FileStreamer
{
public function send($file, $dest = STDOUT)
{
$fh = fopen($file, 'rb');
while (! feof($fh)) {
$data = fread($fh, 8192);
fwrite($dest, $data);
}
#!/bin/sh
# ################################################
rpm_rte="rpm.rte"
rpm_wget="wget-1.9.1-1.aix5.1.ppc.rpm"
# ################################################
# Setup rpm and wget
# ################################################
function setup_rpm {
rm /usr/bin/rpm
if ! test -e "/QOpenSys/download/$rpm_rte"; then
@chukShirley
chukShirley / composer.json
Created December 1, 2015 14:39
composer.json autoload conflicts?
{
"autoload": {
"classmap": ["ToolkitApi/"],
"psr-4": {
"ToolkitApi\\":"ToolkitApi",
}
},
"autoload-dev": {
"psr-4": {
"ToolkitApiTest\\":"tests/ToolkitApiTest"