<?php

namespace AbleCore\Modules;

class ImageStyleManager {

	protected $styles = array();

	/**
	 * Init
	 *
	 * @return ImageStyleManager A new instance of the ImageStyleManager.
	 */
	public static function init()
	{
		return new self();
	}

	/**
	 * Define
	 *
	 * @param string $name    The machine name of the image style.
	 * @param string $label   The human-readable label of the image style.
	 * @param array  $effects An array of effects to attach to the style.
	 *
	 * @return ImageStyle The generated image style.
	 */
	public function define($name, $label, $effects = array())
	{
		$style = new ImageStyle($name, $label, $effects);
		$this->styles[] = $name;
		return $style;
	}

	/**
	 * Finish
	 *
	 * @return array The final result, ready to pass to hook_image_default_styles()
	 */
	public function fin()
	{
		$generated = array();
		foreach ($this->styles as $style) {
			/** @var ImageStyle $style */
			$generated[$style->getName()] = $style->getDefinition();
		}

		return $generated;
	}

}

<?php

namespace AbleCore\Modules;

class ImageStyleManager {

	protected $styles = array();

	/**
	 * Init
	 *
	 * @return ImageStyleManager A new instance of the ImageStyleManager.
	 */
	public static function init()
	{
		return new self();
	}

	/**
	 * Define
	 *
	 * @param string $name    The machine name of the image style.
	 * @param string $label   The human-readable label of the image style.
	 * @param array  $effects An array of effects to attach to the style.
	 *
	 * @return ImageStyle The generated image style.
	 */
	public function define($name, $label, $effects = array())
	{
		$style = new ImageStyle($name, $label, $effects);
		$this->styles[] = $style;
		return $style;
	}

	/**
	 * Finish
	 *
	 * @return array The final result, ready to pass to hook_image_default_styles()
	 */
	public function fin()
	{
		$generated = array();
		foreach ($this->styles as $style) {
			/** @var ImageStyle $style */
			$generated[$style->getName()] = $style->getDefinition();
		}

		return $generated;
	}

}

Make sure we assign the right thing to the styles array.
Make sure we assign the right thing to the styles array.
