Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
New: ported YAML module to new module format
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartherbert committed Mar 8, 2016
1 parent 112c59d commit 8442d13
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 4 deletions.
63 changes: 63 additions & 0 deletions src/php/Storyplayer/SPv2/Modules/Yaml.php
@@ -0,0 +1,63 @@
<?php

/**
* Copyright (c) 2011-present Mediasift Ltd
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the names of the copyright holders nor the names of his
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Libraries
* @package Storyplayer/Modules/Yaml
* @author Stuart Herbert <stuart.herbert@datasift.com>
* @copyright 2011-present Mediasift Ltd www.datasift.com
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://datasift.github.io/storyplayer
*/

namespace Storyplayer\SPv2\Modules;

use DataSift\Storyplayer\PlayerLib\StoryTeller;

use Storyplayer\SPv2\Modules\Yaml\UsingYamlFile;

class Yaml
{
/**
* perform an action on a YAML file
*
* @param string $filename
* the name of the file to work with
* @return UsingYamlFile
*/
public static function usingYamlFile($filename)
{
return new UsingYamlFile($filename);
}
}
Expand Up @@ -33,20 +33,20 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @category Libraries
* @package Storyplayer/Prose
* @author Stuart Herbert <stuart.herbert@datasift.com>
* @copyright 2011-present Mediasift Ltd www.datasift.com
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://datasift.github.io/storyplayer
*/

namespace Prose;
namespace Storyplayer\SPv2\Modules\Yaml;

use DataSift\Storyplayer\PlayerLib\StoryTeller;
use DataSift\Stone\DataLib\DataPrinter;
use Prose\Prose;
use Symfony\Component\Yaml\Dumper;
use Storyplayer\SPv2\Modules\Exceptions;
use Storyplayer\SPv2\Modules\Log;

/**
* Support for working with YAML files
Expand Down Expand Up @@ -79,7 +79,7 @@ public function writeDataToFile($params)
// what are we doing?
$printer = new DataPrinter();
$logParams = $printer->convertToString($params);
$log = usingLog()->startAction("create YAML file '{$filename}' with contents '{$logParams}'");
$log = Log::usingLog()->startAction("create YAML file '{$filename}' with contents '{$logParams}'");

// create an instance of the Symfony YAML writer
$writer = new Dumper();
Expand Down

0 comments on commit 8442d13

Please sign in to comment.