当前位置: 首页>>代码示例>>PHP>>正文


PHP Importer\pestle_import函数代码示例

本文整理汇总了PHP中Pulsestorm\Pestle\Importer\pestle_import函数的典型用法代码示例。如果您正苦于以下问题:PHP pestle_import函数的具体用法?PHP pestle_import怎么用?PHP pestle_import使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pestle_import函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testBothAtOne

 public function testBothAtOne()
 {
     pestle_import('Pulsestorm\\Pestle\\Library\\output');
     ob_start();
     output("Hello");
     $string = ob_get_clean();
     $this->assertEquals($string, 'Hello' . "\n");
     pestle_import('Pulsestorm\\Magento2\\Cli\\Test_Output\\output');
     ob_start();
     output("Hello");
     $string = ob_get_clean();
     $this->assertEquals($string, 'I am hard coded and here for a test.');
 }
开发者ID:astorm,项目名称:pestle,代码行数:13,代码来源:DoubleImportTest.php

示例2: createControllerClassTemplate

<?php

namespace Pulsestorm\Magento2\Cli\Generate\Route;

use function Pulsestorm\Pestle\Importer\pestle_import;
use Exception;
pestle_import('Pulsestorm\\Pestle\\Library\\input');
pestle_import('Pulsestorm\\Pestle\\Library\\inputOrIndex');
pestle_import('Pulsestorm\\Pestle\\Library\\output');
pestle_import('Pulsestorm\\Magento2\\Cli\\Library\\askForModuleAndReturnInfo');
pestle_import('Pulsestorm\\Xml_Library\\simpleXmlAddNodesXpath');
pestle_import('Pulsestorm\\Xml_Library\\formatXmlString');
pestle_import('Pulsestorm\\Pestle\\Library\\writeStringToFile');
pestle_import('Pulsestorm\\Magento2\\Cli\\Xml_Template\\getBlankXml');
pestle_import('Pulsestorm\\Magento2\\Cli\\Path_From_Class\\getPathFromClass');
function createControllerClassTemplate($class, $extends = false, $implements = false)
{
    $class = trim($class, '\\');
    $parts = explode('\\', $class);
    $name = array_pop($parts);
    $template = '<' . '?' . 'php' . "\n" . 'namespace ' . implode('\\', $parts) . ";\n" . "class {$name}";
    if ($extends) {
        $template .= " extends {$extends}";
    }
    if ($implements) {
        $template .= " implements {$implements}";
    }
    $template .= "\n" . '{' . '<$body$>' . '}' . "\n";
    return $template;
}
function createControllerClass($class, $area)
开发者ID:benmarks,项目名称:pestle,代码行数:31,代码来源:module.php

示例3: pestle_cli

namespace Pulsestorm\Magento2\Cli\Generate\Route;

use function Pulsestorm\Pestle\Importer\pestle_import;
use Exception;
pestle_import('Pulsestorm\\Pestle\\Library\\input');
pestle_import('Pulsestorm\\Pestle\\Library\\inputOrIndex');
pestle_import('Pulsestorm\\Pestle\\Library\\output');
pestle_import('Pulsestorm\\Magento2\\Cli\\Library\\askForModuleAndReturnInfo');
pestle_import('Pulsestorm\\Xml_Library\\simpleXmlAddNodesXpath');
pestle_import('Pulsestorm\\Xml_Library\\formatXmlString');
pestle_import('Pulsestorm\\Pestle\\Library\\writeStringToFile');
pestle_import('Pulsestorm\\Magento2\\Cli\\Xml_Template\\getBlankXml');
pestle_import('Pulsestorm\\Magento2\\Cli\\Path_From_Class\\getPathFromClass');
pestle_import('Pulsestorm\\Cli\\Code_Generation\\createControllerClassTemplate');
pestle_import('Pulsestorm\\Cli\\Code_Generation\\createControllerClass');
/**
* Creates a Route XML
* generate_route module area id 
* @command generate_route
*/
function pestle_cli($argv)
{
    $module_info = askForModuleAndReturnInfo($argv);
    $module = $module_info->name;
    $legend = ['frontend' => 'standard', 'adminhtml' => 'admin'];
    $areas = array_keys($legend);
    $area = inputOrIndex('Which area? [frontend, adminhtml]', 'frontend', $argv, 1);
    $router_id = $legend[$area];
    if (!in_array($area, $areas)) {
        throw new Exception("Invalid areas");
开发者ID:mrtuvn,项目名称:pestle,代码行数:30,代码来源:module.php

示例4: swapExtension

<?php

namespace Pulsestorm\Cli\Md_To_Say;

use function Pulsestorm\Pestle\Importer\pestle_import;
pestle_import('Pulsestorm\\Pestle\\Library\\output');
pestle_import('Pulsestorm\\Pestle\\Library\\inputOrIndex');
use Michelf\Markdown;
function swapExtension($filename, $from, $to)
{
    return preg_replace('%\\.' . $from . '$%', '.' . $to, $filename);
}
/**
* Converts a markdown files to an aiff
* @command md_to_say
*/
function pestle_cli($argv)
{
    $file = inputOrIndex("Path to Markdown File?", null, $argv, 0);
    $contents = file_get_contents($file);
    $html = Markdown::defaultTransform($contents);
    $html = preg_replace('%<pre><code>.+?</code></pre>%six', '<p>[CODE SNIPPED].</p>', $html);
    $html = str_replace('</p>', '</p><br>', $html);
    $tmp = tempnam('/tmp', 'md_to_say') . '.html';
    file_put_contents($tmp, $html);
    $cmd = 'textutil -convert txt ' . $tmp;
    `{$cmd}`;
    $tmp_txt = swapExtension($tmp, 'html', 'txt');
    $tmp_aiff = swapExtension($tmp, 'html', 'aiff');
    $cmd = "say -f {$tmp_txt} -o {$tmp_aiff}";
    output($cmd);
开发者ID:astorm,项目名称:pestle,代码行数:31,代码来源:module.php

示例5: createFrontendFolders

<?php

namespace Pulsestorm\Magento2\Cli\Generate\Theme;

use function Pulsestorm\Pestle\Importer\pestle_import;
pestle_import('Pulsestorm\\Pestle\\Library\\output');
pestle_import('Pulsestorm\\Pestle\\Library\\writeStringToFile');
pestle_import('Pulsestorm\\Magento2\\Cli\\Library\\getBaseMagentoDir');
pestle_import('Pulsestorm\\Xml_Library\\simpleXmlAddNodesXpath');
pestle_import('Pulsestorm\\Magento2\\Cli\\Xml_Template\\getBlankXml');
pestle_import('Pulsestorm\\Xml_Library\\formatXmlString');
pestle_import('Pulsestorm\\Cli\\Code_Generation\\templateRegistrationPhp');
function createFrontendFolders($base_folder, $package, $theme, $area)
{
    //web/css/source
    //fonts
    //images
    //js
    $folders = [$base_folder . '/web/css/source', $base_folder . '/fonts', $base_folder . '/images', $base_folder . '/js'];
    foreach ($folders as $folder) {
        if (!is_dir($folder)) {
            output("Creating: {$folder}");
            mkdir($folder, 0755, true);
        } else {
            output("Exists: {$folder}");
        }
    }
}
function createThemeXmlFile($base_folder, $package, $theme, $area, $parent_name)
{
    $path = $base_folder . '/theme.xml';
开发者ID:astorm,项目名称:pestle,代码行数:31,代码来源:module.php

示例6: pestle_cli

<?php

namespace Pulsestorm\Magento2\Cli\Extract_Mage2_System_Xml_Paths;

use function Pulsestorm\Pestle\Importer\pestle_import;
pestle_import('Pulsestorm\\Pestle\\Library\\input');
pestle_import('Pulsestorm\\Pestle\\Library\\output');
pestle_import('Pulsestorm\\Magento2\\Cli\\Library\\getSimpleTreeFromSystemXmlFile');
/**
* Generates Mage2 config.xml
* Extracts configuration path's from a Magento 2 module's
* system.xml file, and then generates a config.xml file
* for the creation of default values
*
* @command extract_mage2_system_xml_paths
*/
function pestle_cli($argv)
{
    $paths = $argv;
    if (count($argv) === 0) {
        $paths = [input("Which system.xml?", './app/code/Magento/Theme/etc/adminhtml/system.xml')];
    }
    foreach ($paths as $path) {
        $tree = getSimpleTreeFromSystemXmlFile($path);
    }
    $xml = simplexml_load_string('<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"><default></default></config>');
    foreach ($tree as $section => $groups) {
        $section = $xml->default->addChild($section);
        foreach ($groups as $group => $fields) {
            $group = $section->addChild($group);
            foreach ($fields as $field) {
开发者ID:astorm,项目名称:pestle,代码行数:31,代码来源:module.php

示例7: pestle_cli

<?php

namespace Pulsestorm\Magento2\Cli\Generate\Observer;

use function Pulsestorm\Pestle\Importer\pestle_import;
pestle_import('Pulsestorm\\Cli\\Code_Generation\\createClassTemplate');
pestle_import('Pulsestorm\\Pestle\\Library\\input');
pestle_import('Pulsestorm\\Pestle\\Library\\output');
pestle_import('Pulsestorm\\Magento2\\Cli\\Library\\initilizeModuleConfig');
pestle_import('Pulsestorm\\Pestle\\Library\\writeStringToFile');
pestle_import('Pulsestorm\\Magento2\\Cli\\Library\\createClassFile');
/**
* Generates Magento 2 Observer
* This command generates the necessary files and configuration to add 
* an event observer to a Magento 2 system.
*
*    pestle.phar generate_observer Pulsestorm_Generate controller_action_predispatch pulsestorm_generate_listener3 'Pulsestorm\Generate\Model\Observer3'
*
* @command generate_observer
* @argument module Full Module Name? [Pulsestorm_Generate]
* @argument event_name Event Name? [controller_action_predispatch]
* @argument observer_name Observer Name? [<$module$>_listener]
* @argument model_name Class Name? [<$module$>\Model\Observer]
*/
function pestle_cli($argv)
{
    $module = $argv['module'];
    $event_name = $argv['event_name'];
    $observer_name = $argv['observer_name'];
    $model_name = $argv['model_name'];
    $method_name = 'execute';
开发者ID:astorm,项目名称:pestle,代码行数:31,代码来源:module.php

示例8: createControllerClassName

namespace Pulsestorm\Magento2\Cli\Generate\Route;

use function Pulsestorm\Pestle\Importer\pestle_import;
use Exception;
pestle_import('Pulsestorm\\Pestle\\Library\\input');
pestle_import('Pulsestorm\\Pestle\\Library\\inputOrIndex');
pestle_import('Pulsestorm\\Pestle\\Library\\output');
pestle_import('Pulsestorm\\Magento2\\Cli\\Library\\askForModuleAndReturnInfo');
pestle_import('Pulsestorm\\Xml_Library\\simpleXmlAddNodesXpath');
pestle_import('Pulsestorm\\Xml_Library\\formatXmlString');
pestle_import('Pulsestorm\\Pestle\\Library\\writeStringToFile');
pestle_import('Pulsestorm\\Magento2\\Cli\\Xml_Template\\getBlankXml');
pestle_import('Pulsestorm\\Magento2\\Cli\\Path_From_Class\\getPathFromClass');
pestle_import('Pulsestorm\\Cli\\Code_Generation\\createControllerClassTemplate');
pestle_import('Pulsestorm\\Cli\\Code_Generation\\createControllerClass');
pestle_import('Pulsestorm\\Magento2\\Cli\\Library\\getModuleInformation');
function createControllerClassName($module, $area = 'frontend')
{
    $class = str_replace('_', '\\', $module) . '\\Controller';
    if ($area === 'adminhtml') {
        $class .= '\\Adminhtml';
    }
    $class .= '\\Index\\Index';
    return $class;
}
function getRouterIdFromArea($area)
{
    $legend = ['frontend' => 'standard', 'adminhtml' => 'admin'];
    $areas = array_keys($legend);
    if (!in_array($area, $areas)) {
        throw new Exception("Could not find router id for area");
开发者ID:astorm,项目名称:pestle,代码行数:31,代码来源:module.php

示例9: pestle_cli

<?php

namespace Pulsestorm\Magento2\Cli\Check_Registration;

use function Pulsestorm\Pestle\Importer\pestle_import;
pestle_import('Pulsestorm\\Pestle\\Library\\output');
pestle_import('Pulsestorm\\Pestle\\Library\\input');
pestle_import('Pulsestorm\\Magento2\\Cli\\Library\\templateRegistrationPhp');
/**
* Short Description
* Long
* Description
* @command check_registration
*/
function pestle_cli($argv)
{
    $path = 'app/code';
    if (count($argv) > 0) {
        $Path = $argv[0];
    }
    foreach (glob($path . '/*/*') as $file) {
        $parts = explode('/', $file);
        $module = implode('_', array_slice($parts, count($parts) - 2));
        $file = $file . '/' . 'registration.php';
        if (file_exists($file)) {
            output("Registration Exists");
            $contents = file_get_contents($file);
            if (strpos($contents, "'" . $module . "'") !== false) {
                output("Registration contains {$module} string");
                continue;
            }
开发者ID:benmarks,项目名称:pestle,代码行数:31,代码来源:module.php

示例10: error_reporting

<?php

namespace Pulsestorm\Magento2\Cli\Export_Module;

error_reporting(E_ALL);
use function Pulsestorm\Pestle\Importer\pestle_import;
pestle_import('Pulsestorm\\Pestle\\Library\\output');
pestle_import('Pulsestorm\\Cli\\Token_Parse\\pestle_token_get_all');
pestle_import('Pulsestorm\\Pestle\\Importer\\getPathFromFunctionName');
function getNextTConstantEncapsedStringFromTokenArray($tokens, $index)
{
    $tokens = array_slice($tokens, $index + 1);
    foreach ($tokens as $token) {
        if ($token->token_name === 'T_CONSTANT_ENCAPSED_STRING') {
            return $token;
        }
    }
}
function isTokenFunction($token, $function, $tokens, $index)
{
    if (!isset($tokens[$index + 1])) {
        return false;
    }
    if ($tokens[$index + 1]->token_name === 'T_WHITESPACE') {
        $index++;
        return isTokenFunction($tokens[$index], $function, $tokens, $index);
    }
    return !($token->token_value !== $function || $tokens[$index + 1]->token_value !== '(');
}
function isTokenPestleImport($token, $tokens, $index)
{
开发者ID:astorm,项目名称:pestle,代码行数:31,代码来源:module.php

示例11: setup

<?php

namespace Pulsestorm\Pestle\Tests;

require_once 'PestleBaseTest.php';
use function Pulsestorm\Pestle\Importer\pestle_import;
pestle_import('Pulsestorm\\Cli\\Code_Generation\\createClassTemplate');
pestle_import('Pulsestorm\\Pestle\\Library\\isAboveRoot');
class LibraryTest extends PestleBaseTest
{
    public function setup()
    {
        $path = $this->getPathToModuleFileUnderTest('modules/pulsestorm/magento2/cli/library/module.php');
        require_once $path;
    }
    public function testSetup()
    {
        $this->assertEquals(-1, -1);
    }
    public function testCreateClassTemplate()
    {
        $fixture = '<' . '?php
namespace ;
class Foo
{<$body$>}' . "\n";
        $template = createClassTemplate('Foo');
        $this->assertEquals($template, $fixture);
    }
    public function testIsAboveRoot1()
    {
        $path = '/foo/baz/bar/../../../../';
开发者ID:astorm,项目名称:pestle,代码行数:31,代码来源:LibraryTest.php

示例12: getPackageAndModuleNameFromListingXmlFile

<?php

namespace Pulsestorm\Magento2\Cli\Magento2_Generate_Ui_Add_Column_Actions;

use function Pulsestorm\Pestle\Importer\pestle_import;
pestle_import('Pulsestorm\\Pestle\\Library\\output');
pestle_import('Pulsestorm\\Xml_Library\\formatXmlString');
pestle_import('Pulsestorm\\Magento2\\Cli\\Library\\addArgument');
pestle_import('Pulsestorm\\Magento2\\Cli\\Library\\addItem');
pestle_import('Pulsestorm\\Magento2\\Cli\\Library\\validateAsListing');
pestle_import('Pulsestorm\\Magento2\\Cli\\Library\\getOrCreateColumnsNode');
function getPackageAndModuleNameFromListingXmlFile($file)
{
    if (strpos($file, 'app/code') === false) {
        output("At the time this command was written, pestle assumed app/code as a working directory");
        output("That file isn't in app/code, so we need to bail :(");
        exit;
    }
    $parts = explode('app/code/', $file);
    $parts = explode('/', array_pop($parts));
    return [$parts[0], $parts[1]];
}
function getGridIdFromListingXmlFile($xml)
{
    $stuff = pathinfo($xml);
    return $stuff['filename'];
}
function generatePageActionsClassFromListingXmlFileAndXml($file, $xml)
{
    list($package, $moduleName) = getPackageAndModuleNameFromListingXmlFile($file);
    $gridId = getGridIdFromListingXmlFile($file);
开发者ID:astorm,项目名称:pestle,代码行数:31,代码来源:module.php

示例13: getListOfFilesInModuleFolder

<?php

namespace Pulsestorm\Cli\Build_Command_List;

use RecursiveIteratorIterator;
use RecursiveDirectoryIterator;
use ReflectionFunction;
use function Pulsestorm\Pestle\Importer\pestle_import;
pestle_import('Pulsestorm\\Pestle\\Library\\output');
pestle_import('Pulsestorm\\Pestle\\Library\\getDocCommentAsString');
pestle_import('Pulsestorm\\Pestle\\Importer\\getCacheDir');
pestle_import('Pulsestorm\\Pestle\\Runner\\getBaseProjectDir');
pestle_import('Pulsestorm\\Pestle\\Library\\parseDocBlockIntoParts');
function getListOfFilesInModuleFolder()
{
    $path = getBaseProjectDir() . '/modules/';
    $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST);
    return $objects;
}
function includeAllModuleFiles()
{
    $objects = getListOfFilesInModuleFolder();
    // $path = realpath('modules/');
    // $objects = new RecursiveIteratorIterator(
    //     new RecursiveDirectoryIterator($path),
    //     RecursiveIteratorIterator::SELF_FIRST
    // );
    foreach ($objects as $name => $object) {
        $info = pathinfo($name);
        if ($info['basename'] == 'module.php') {
            require_once $name;
开发者ID:astorm,项目名称:pestle,代码行数:31,代码来源:module.php

示例14: testsOutput

<?php

namespace Pulsestorm\Pestle\Tests\Foo;

use Pulsestorm\Pestle\Tests\PestleBaseTest;
require_once 'PestleBaseTest.php';
use function Pulsestorm\Pestle\Importer\pestle_import;
pestle_import('Pulsestorm\\Magento2\\Cli\\Library\\createClassTemplate');
pestle_import('Pulsestorm\\PhpDotNet\\glob_recursive');
pestle_import('Pulsestorm\\Pestle\\Library\\output');
pestle_import('Pulsestorm\\Pestle\\Importer\\getNamespaceCalledFrom');
class NamespaceRefactoringTest extends PestleBaseTest
{
    public function testsOutput()
    {
        ob_start();
        output("Hello");
        $results = ob_get_clean();
        $this->assertEquals(trim($results), "Hello");
    }
    public function testsFunctionExists()
    {
        $this->assertTrue(function_exists('glob_recursive'));
    }
}
function cleverHackToTestReflectionFunction()
{
    return getNamespaceCalledFrom();
}
/**
* @command library
开发者ID:benmarks,项目名称:pestle,代码行数:31,代码来源:NamespaceRefactoringTest.php

示例15: testNamespaceGenerate1

<?php

namespace Pulsestorm\Pestle\Tests;

require_once 'PestleBaseTest.php';
use function Pulsestorm\Pestle\Importer\pestle_import;
pestle_import('Pulsestorm\\Magento2\\Cli\\Generate\\Mage2_Command\\createNamespaceFromCommandName');
// use function Pulsestorm\Magento2\Cli\Generate\Mage2_Command\createNamespaceFromCommandName;
class GenerateMage2CommandTest extends PestleBaseTest
{
    public function testNamespaceGenerate1()
    {
        $path = createNamespaceFromCommandName('science');
        $this->assertEquals('Pulsestorm\\Magento2\\Cli\\Science', $path);
    }
    public function testNamespaceGenerate2()
    {
        $path = createNamespaceFromCommandName('generate_science');
        $this->assertEquals('Pulsestorm\\Magento2\\Cli\\Generate\\Science', $path);
    }
    public function testNamespaceGenerate3()
    {
        $path = createNamespaceFromCommandName('foo_science');
        $this->assertEquals('Pulsestorm\\Magento2\\Cli\\Foo_Science', $path);
    }
}
开发者ID:benmarks,项目名称:pestle,代码行数:26,代码来源:GenerateMage2CommandTest.php


注:本文中的Pulsestorm\Pestle\Importer\pestle_import函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。