Skip to content

Commit ddb5c5d

Browse files
committed
Improve doc comments for the source/target API
1 parent b9ac979 commit ddb5c5d

File tree

2 files changed

+36
-18
lines changed

2 files changed

+36
-18
lines changed

src/Source.php

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ public function __construct(\FFI\CData $pointer)
1919
}
2020

2121
/**
22-
* Make a new source from a file descriptor (a small integer).
23-
* Make a new source that is attached to the descriptor. For example:
24-
* $source = VipsSource::newFromDescriptor(0)
22+
* Make a new source from a file descriptor. For example:
23+
*
24+
* ```php
25+
* $source = Source::newFromDescriptor(0);
26+
* ```
27+
*
2528
* Makes a descriptor attached to stdin.
2629
* You can pass this source to (for example) @see Image::newFromSource()
2730
* @throws Exception
@@ -38,9 +41,12 @@ public static function newFromDescriptor(int $descriptor): self
3841
}
3942

4043
/**
41-
* Make a new source from a filename.
42-
* Make a new source that is attached to the named file. For example:
43-
* $source = VipsSource::newFromFile("myfile.jpg")
44+
* Make a new source from a filename. For example:
45+
*
46+
* ```php
47+
* $source = Source::newFromFile("myfile.jpg");
48+
* ```
49+
*
4450
* You can pass this source to (for example) @see Image::newFromSource()
4551
* @throws Exception
4652
*/
@@ -56,9 +62,12 @@ public static function newFromFile(string $filename): self
5662
}
5763

5864
/**
59-
* Make a new source from a filename.
60-
* Make a new source that uses the provided $data. For example:
61-
* $source = VipsSource::newFromFile(file_get_contents("myfile.jpg"))
65+
* Make a new source from a memory buffer. For example:
66+
*
67+
* ```php
68+
* $source = Source::newFromMemory(file_get_contents("myfile.jpg"));
69+
* ```
70+
*
6271
* You can pass this source to (for example) @see Image::newFromSource()
6372
* @throws Exception
6473
*/

src/Target.php

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ public function __construct(\FFI\CData $pointer)
1919
}
2020

2121
/**
22-
* Make a new target to write to a file descriptor (a small integer).
23-
* Make a new target that is attached to the descriptor. For example::
24-
* $target = VipsTarget.newToDescriptor(1)
22+
* Make a new target to write to a file descriptor. For example:
23+
*
24+
* ```php
25+
* $target = Target::newToDescriptor(1);
26+
* ```
27+
*
2528
* Makes a descriptor attached to stdout.
2629
* You can pass this target to (for example) @see Image::writeToTarget()
2730
* @throws Exception
@@ -37,9 +40,12 @@ public static function newToDescriptor(int $descriptor): self
3740
}
3841

3942
/**
40-
* Make a new target to write to a file name.
41-
* Make a new target that is attached to the file name. For example::
42-
* $target = VipsTarget.newToFile("myfile.jpg")
43+
* Make a new target to write to a filename. For example:
44+
*
45+
* ```php
46+
* $target = Target::newToFile("myfile.jpg");
47+
* ```
48+
*
4349
* You can pass this target to (for example) @see Image::writeToTarget()
4450
* @throws Exception
4551
*/
@@ -55,9 +61,12 @@ public static function newToFile(string $filename): self
5561
}
5662

5763
/**
58-
* Make a new target to write to a memory buffer.
59-
* For example::
60-
* $target = VipsTarget.newToMemory()
64+
* Make a new target to write to a memory buffer. For example:
65+
*
66+
* ```php
67+
* $target = Target::newToMemory();
68+
* ```
69+
*
6170
* You can pass this target to (for example) @see Image::writeToTarget()
6271
* @throws Exception
6372
*/

0 commit comments

Comments
 (0)