Skip to content

Instantly share code, notes, and snippets.

@simkimsia
Created November 14, 2013 02:45
Show Gist options
  • Select an option

  • Save simkimsia/7460467 to your computer and use it in GitHub Desktop.

Select an option

Save simkimsia/7460467 to your computer and use it in GitHub Desktop.
Example of the template Behavior from https://gist.github.com/simkimsia/7460428
<?php
/**
* ReplaceableBehavior class file.
*
* Replaces `unicorn` in an array with `super_duper_unicorn`
*
* Usage is straightforward:
* In model: $array = $this->replaceWithSuper($array);
*
* Copyright 2013, Kim Stacks
* Singapore
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2013, Kim Stacks.
* @link http://stacktogether.com
* @author Kim Stacks <kim@stacktogether.com>
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
* @package SuperDuperMakeUnicorns
* @subpackage SuperDuperMakeUnicorns.Model.Behavior
* @version 0.1.0
*/
class ReplaceableBehavior extends ModelBehavior {
/**
* Behavior settings
*
* @access public
* @var array
*/
public $settings = array();
/**
* Initiate behavior for the model using specified settings.
*
* @param Model $Model
* @param array $config
* @return void
*/
public function setup(Model $Model, $settings = array()) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment