Skip to content

Instantly share code, notes, and snippets.

<?php
class Repository
{
const TABLE = 'contacts';
/* snip */
public function edit(Contact $contact)
<?php
/**
* Ushahidi Array Exchange Trait
*
* Gives objects two new methods:
*
* 1. `setData($arrayhash)`, updating the object properties and returning `$this`
* 2. `asArray()`, getting the object properties as an array
*
@shadowhand
shadowhand / Config.php
Created May 9, 2014 18:04
Config Entity
<?php
/**
* Ushahidi Config Entity
*
* @author Ushahidi Team <team@ushahidi.com>
* @package Ushahidi\Application
* @copyright 2014 Ushahidi
* @license https://www.gnu.org/licenses/agpl-3.0.html GNU Affero General Public License Version 3 (AGPL3)
*/
@shadowhand
shadowhand / TagSpec.php
Last active August 29, 2015 14:01
Testing side effects with phpspec
<?php
namespace spec\Ushahidi\Usecase\Admin\Tag;
use Ushahidi\Entity\Tag;
use Ushahidi\Tool\Validator;
use Ushahidi\Usecase\Admin\Tag\CreateTagRepository;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
<?php
/**
* Ushahidi Platform Admin Tag Create Use Case
*
* @author Ushahidi Team <team@ushahidi.com>
* @package Ushahidi\Platform
* @copyright 2014 Ushahidi
* @license https://www.gnu.org/licenses/agpl-3.0.html GNU Affero General Public License Version 3 (AGPL3)
*/
@shadowhand
shadowhand / 0_reuse_code.js
Created May 17, 2014 00:43
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@shadowhand
shadowhand / CreateSpec.php
Created May 17, 2014 18:15
usecase spec for creating a tag
<?php
namespace spec\Ushahidi\Usecase\Tag;
use Ushahidi\Tool\Validator;
use Ushahidi\Usecase\Tag\CreateTagRepository;
use Ushahidi\Usecase\Tag\CreateTagRequest;
use PhpSpec\ObjectBehavior;
@shadowhand
shadowhand / Login.php
Created May 19, 2014 14:50
User login use case
<?php
/**
* Ushahidi Platform User Login Use Case
*
* @author Ushahidi Team <team@ushahidi.com>
* @package Ushahidi\Platform
* @copyright 2014 Ushahidi
* @license https://www.gnu.org/licenses/agpl-3.0.html GNU Affero General Public License Version 3 (AGPL3)
*/
@shadowhand
shadowhand / Repository.php
Created May 19, 2014 17:02
Basic query builder functions
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Ushahidi Repository
*
* @author Ushahidi Team <team@ushahidi.com>
* @package Ushahidi\Application
* @copyright 2014 Ushahidi
* @license https://www.gnu.org/licenses/agpl-3.0.html GNU Affero General Public License Version 3 (AGPL3)
*/
@shadowhand
shadowhand / User.php
Created May 19, 2014 17:22
User repository implements multiple interfaces
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Ushahidi User Repository
*
* Also implements registration checks
*
* @author Ushahidi Team <team@ushahidi.com>
* @package Ushahidi\Application
* @copyright 2014 Ushahidi