Skip to content

Instantly share code, notes, and snippets.

View pierredup's full-sized avatar
🐢
squirreling

Pierre du Plessis pierredup

🐢
squirreling
View GitHub Profile
<?php
class AdapterFactory
{
private $adapters = [];
public function registerAdapter($name, callback $adapterFactory, callback $adapterConfigurator
{
$this->adapter[$adapter] = [$adapterFactory, $adapterConfigurator];
}
@pierredup
pierredup / example.php
Last active December 18, 2015 19:49 — forked from ircmaxell/example.php
<?php
function runMigration() {
foreach (getUsers() as $user) {
$hash = $user->hash;
list ($oldhash, $oldsalt) = explode(':', $hash, 2);
$newHash = password_migrate_create($oldhash, $oldsalt, PASSWORD_BCRYPT);
$user->hash = $newHash;
saveUser($user);
}