Conditions | 3 |
Paths | 2 |
Total Lines | 22 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
41 | public function create() |
||
42 | { |
||
43 | $directory = GC_DIR_UPLOAD . '/faker'; |
||
44 | |||
45 | if (!file_exists($directory) && !mkdir($directory, 0775)) { |
||
46 | return false; |
||
47 | } |
||
48 | |||
49 | $topics = (array) $this->config->get('module_faker_image_topics', array('abstract', 'technics')); |
||
50 | $image = $this->faker->image($directory, 500, 500, $topics[array_rand($topics)], true); |
||
51 | |||
52 | $field = array( |
||
53 | 'entity' => '', |
||
54 | 'entity_id' => '', |
||
55 | 'title' => $this->faker->text(50), |
||
56 | 'description' => $this->faker->text(100), |
||
57 | 'weight' => $this->faker->numberBetween(0, 20), |
||
58 | 'path' => str_replace('\\', '/', gplcart_file_relative($image)) |
||
59 | ); |
||
60 | |||
61 | return (bool) $this->file->add($field); |
||
62 | } |
||
63 | |||
65 |