Supported Versions: PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8
Pad a string to a certain length with another string
<?php str_pad( string $string, int $length, string $pad_string = " ", int $pad_type = STR_PAD_RIGHT): string
<?php protected function disableForeignKeyConstraints($stub): string
{
$stub = str_replace('Schema::create(', 'Schema::disableForeignKeyConstraints();' . PHP_EOL . PHP_EOL . str_pad(' ', 8) . 'Schema::create(', $stub);
$stub = str_replace('});', '});' . PHP_EOL . PHP_EOL . str_pad(' ', 8) . 'Schema::enableForeignKeyConstraints();', $stub);
<?php {
$stub = str_replace('Schema::create(', 'Schema::disableForeignKeyConstraints();' . PHP_EOL . PHP_EOL . str_pad(' ', 8) . 'Schema::create(', $stub);
$stub = str_replace('});', '});' . PHP_EOL . PHP_EOL . str_pad(' ', 8) . 'Schema::enableForeignKeyConstraints();', $stub);
return $stub;
}
<?php }
$assertion .= ' {' . PHP_EOL;
$assertion .= str_pad(' ', 12);
$assertion .= 'return ' . implode(' && ', $conditions) . ';';
$assertion .= PHP_EOL . str_pad(' ', 8) . '}';
}
<?php $assertion .= ' {' . PHP_EOL;
$assertion .= str_pad(' ', 12);
$assertion .= 'return ' . implode(' && ', $conditions) . ';';
$assertion .= PHP_EOL . str_pad(' ', 8) . '}';
}
$assertion .= ');';
<?php }
$assertion .= ' {' . PHP_EOL;
$assertion .= str_pad(' ', 12);
$assertion .= 'return ' . implode(' && ', $conditions) . ';';
$assertion .= PHP_EOL . str_pad(' ', 8) . '}';
}
<?php $assertion .= ' {' . PHP_EOL;
$assertion .= str_pad(' ', 12);
$assertion .= 'return ' . implode(' && ', $conditions) . ';';
$assertion .= PHP_EOL . str_pad(' ', 8) . '}';
}
$assertion .= ');';
<?php }
$assertion .= ' {' . PHP_EOL;
$assertion .= str_pad(' ', 12);
$assertion .= 'return ' . implode(' && ', $conditions) . ';';
$assertion .= PHP_EOL . str_pad(' ', 8) . '}';
}
<?php $assertion .= ' {' . PHP_EOL;
$assertion .= str_pad(' ', 12);
$assertion .= 'return ' . implode(' && ', $conditions) . ';';
$assertion .= PHP_EOL . str_pad(' ', 8) . '}';
}
$assertion .= ');';
<?php }
$assertion .= ' {' . PHP_EOL;
$assertion .= str_pad(' ', 12);
$assertion .= 'return ' . implode(' && ', $conditions) . ';';
$assertion .= PHP_EOL . str_pad(' ', 8) . '}';
}
<?php $assertion .= ' {' . PHP_EOL;
$assertion .= str_pad(' ', 12);
$assertion .= 'return ' . implode(' && ', $conditions) . ';';
$assertion .= PHP_EOL . str_pad(' ', 8) . '}';
}
$assertion .= ');';
<?php $tested_bits |= self::TESTS_SAVE;
if ($request_data) {
$indent = str_pad(' ', 12);
$plural = Str::plural($variable);
$assertion = sprintf('$%s = %s::query()', $plural, $model);
foreach ($request_data as $key => $datum) {
<?php $call .= ', [';
$call .= PHP_EOL;
foreach ($request_data as $key => $datum) {
$call .= str_pad(' ', 12);
$call .= sprintf('\'%s\' => %s,', $key, $datum);
$call .= PHP_EOL;
}
<?php $call .= PHP_EOL;
}
$call .= str_pad(' ', 8) . ']';
}
$call .= ');';
<?php $body = implode(PHP_EOL . PHP_EOL, array_map([$this, 'buildLines'], $this->uniqueSetupLines($setup)));
$body .= PHP_EOL . PHP_EOL;
$body .= str_pad(' ', 8) . $call;
$body .= PHP_EOL . PHP_EOL;
$body .= implode(PHP_EOL . PHP_EOL, array_map([$this, 'buildLines'], array_filter($assertions)));
<?php private function buildLines($lines)
{
return str_pad(' ', 8) . implode(PHP_EOL . str_pad(' ', 8), $lines);
}
private function splitField($field)