Apple_Exporter\Exporter::export PHP Метод

export() публичный Метод

and return the path. This function builds the article and cleans up after.
public export ( ) : string
Результат string
    public function export()
    {
        // If an export or push was cancelled, the workspace might be polluted.
        // Clean beforehand.
        $this->clean_workspace();
        // Build the bundle content.
        $this->generate();
        // Some use cases for this function expect it to return the JSON.
        $json = $this->get_json();
        // Clean after the export action.
        $this->clean_workspace();
        return $json;
    }

Usage Example

 public function testBuildersGetCalled()
 {
     $workspace = $this->prophet->prophesize('\\Apple_Exporter\\Workspace');
     // Cleans up workspace
     $workspace->clean_up()->shouldBeCalled();
     // Writes JSON
     $workspace->write_json(Argument::that(array($this, 'isValidJSON')))->shouldBeCalled();
     // Get JSON
     $workspace->get_json()->shouldBeCalled();
     $builder1 = $this->prophet->prophesize('\\Apple_Exporter\\Builders\\Builder');
     $builder1->to_array()->shouldBeCalled();
     $builder2 = $this->prophet->prophesize('\\Apple_Exporter\\Builders\\Builder');
     $builder2->to_array()->shouldBeCalled();
     $content = new Apple_Exporter\Exporter_Content(3, 'Title', '<p>Example content</p>');
     $exporter = new Exporter($content, $workspace->reveal());
     $exporter->initialize_builders(array('componentTextStyles' => $builder1->reveal(), 'componentLayouts' => $builder2->reveal()));
     $exporter->export();
 }